From 117720197e57d44cc03a225ab2875288bd087fe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyangwei=E2=80=9D?= Date: Wed, 4 Sep 2019 11:47:33 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E8=B0=83=E6=95=B4=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84zlog.conf=E6=A0=BC=E5=BC=8F=202?= =?UTF-8?q?=E3=80=81=E6=9B=B4=E6=96=B0gitignore=E5=86=85=E5=AE=B9=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=8B=E5=8A=A8build=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + demo/test_handle_logger.c | 2 +- src/MESA_handle_logger.c | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 647907e..6862a02 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ core.* version.txt demo/test_handle_logger cmake-build-debug +build-*/ GPATH GRTAGS GTAGS diff --git a/demo/test_handle_logger.c b/demo/test_handle_logger.c index 448c14b..71d0a34 100644 --- a/demo/test_handle_logger.c +++ b/demo/test_handle_logger.c @@ -101,7 +101,7 @@ int main(int argc, char ** args) printf("Error, wrong parameter!\n"); return -1; } - sample_handle = MESA_create_runtime_log_handle("./log/test_log", RLOG_LV_DEBUG); + sample_handle = MESA_create_runtime_log_handle("./log/sample_log", RLOG_LV_DEBUG); if (sample_handle == NULL) { printf("get log sample_handle error\n"); diff --git a/src/MESA_handle_logger.c b/src/MESA_handle_logger.c index 35a73a4..3ec959f 100644 --- a/src/MESA_handle_logger.c +++ b/src/MESA_handle_logger.c @@ -151,7 +151,7 @@ void *MESA_create_runtime_log_handle(const char *file_path, int level) if(fp == NULL)return NULL; char zlog_rule_conf_content[MAX_HANDLE_LOG_PATH + 1]; snprintf(zlog_rule_conf_content, sizeof(zlog_rule_conf_content), - "[global] \n default format = \"%%d(%%c), %%V, %%m%%n\" \n[levels]\n DEBUG=10\n INFO=20\n FATAL=30\n[rules]\n %s.* \"%s.%%d(%%F)\"", + "[global]\ndefault format = \"%%d(%%c), %%V, %%m%%n\" \n[levels]\nDEBUG=10\nINFO=20\nFATAL=30\n[rules]\n %s.* \"%s.%%d(%%F)\"", p_name, file_path); fwrite(zlog_rule_conf_content, strlen(zlog_rule_conf_content), 1, fp); fclose(fp); @@ -181,6 +181,7 @@ void MESA_destroy_runtime_log_handle(void *handle) if(handle != NULL) { log_handle_t *p_handle = (log_handle_t *)handle; + zlog_fini(); free(handle); handle = NULL; }