diff options
| author | yangwei <[email protected]> | 2022-12-01 16:00:28 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2022-12-01 16:00:28 +0800 |
| commit | 4d64f0cf062f3cb88a49ead006659c3d537d1c8c (patch) | |
| tree | cf80361a115f49fd4ba9248f65f55bd97acf8b94 | |
| parent | b677bb6c71ff6041c9fab771f04cb5aafae4afe4 (diff) | |
🐞 fix(g_zlog_inited): 修复多次creation时报错,改为reload
| -rw-r--r-- | src/MESA_handle_logger.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/MESA_handle_logger.c b/src/MESA_handle_logger.c index 8327124..473361c 100644 --- a/src/MESA_handle_logger.c +++ b/src/MESA_handle_logger.c @@ -235,6 +235,14 @@ int MESA_handle_runtime_log_creation(const char *conf_path) { char *env = getenv("ZLOG_CONF_PATH"); int rc = 0; + + if(g_zlog_inited == 1) + { + rc = zlog_reload(conf_path); + zlog_profile(); + return rc; + } + if (conf_path == NULL || (access(conf_path, R_OK) != 0)) { fprintf(stderr,"[MESA_handle_runtime_log_creation], PATH (%s) unable to access, will output log to STDOUT or Using ZLOG_CONF_PATH (%s) !\n", conf_path, env); @@ -327,4 +335,5 @@ void MESA_handle_runtime_log_destruction() unlink(tmp_conf_filepath); close(g_zlog_conf_fp); } + g_zlog_inited=0; } |
