summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2020-09-17 13:34:02 +0800
committeryangwei <[email protected]>2020-09-17 13:34:02 +0800
commit7066b2b08627789c1258a711b59502115159188e (patch)
treecdb2517118ad4071e7aecab7134a69bad44d67e8
parent52db3f0001817438e53e698e82f2c7183656dbe5 (diff)
更新写入snapshot默认部分的定义为const static buff
-rw-r--r--src/MESA_handle_logger.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/MESA_handle_logger.c b/src/MESA_handle_logger.c
index 732bfac..c630867 100644
--- a/src/MESA_handle_logger.c
+++ b/src/MESA_handle_logger.c
@@ -127,7 +127,8 @@ static const char *loglevel_to_name(int level)
static void snapshot_handle_info(const char *handle_name, const char *log_path, int level)
{
- char zlog_rule_conf_content[MAX_HANDLE_LOG_PATH + 1];
+ char zlog_rule_conf_content[MAX_HANDLE_LOG_PATH + 1] = "";
+ static char *zlog_conf_init_buff = "[global]\ndefault format = \"%%d(%%c), %%V, %F, %U, %%m%%n\" \n[levels]\nDEBUG=10\nINFO=20\nFATAL=30\n[rules]";
if (g_zlog_conf_fp == -1)
{
char temp_filename[1024] = "";
@@ -141,9 +142,7 @@ static void snapshot_handle_info(const char *handle_name, const char *log_path,
{
return;
}
- int len = snprintf(zlog_rule_conf_content, sizeof(zlog_rule_conf_content),
- "[global]\ndefault format = \"%%d(%%c), %%V, %F, %U, %%m%%n\" \n[levels]\nDEBUG=10\nINFO=20\nFATAL=30\n[rules]");
- write(g_zlog_conf_fp, zlog_rule_conf_content, strlen(zlog_rule_conf_content));
+ write(g_zlog_conf_fp, zlog_conf_init_buff, strlen(zlog_conf_init_buff));
fsync(g_zlog_conf_fp);
}
snprintf(zlog_rule_conf_content, sizeof(zlog_rule_conf_content),