summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoryangwei <[email protected]>2020-09-08 18:20:14 +0800
committeryangwei <[email protected]>2020-09-08 18:20:14 +0800
commitb4f239ae9c1126bcb7a14f62b11b781766c65a1a (patch)
tree5fa62cd3d88db31155a8d78d082753561391aadb /src
parent90fb91cd42674ae368f2d8db609764c49083854b (diff)
UPDATE: snapshot中rules路径使用原始输入的file_path;日志中__FILE__字段使用创建handle时输入的file_path
Diffstat (limited to 'src')
-rw-r--r--src/MESA_handle_logger.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/MESA_handle_logger.c b/src/MESA_handle_logger.c
index 35348c1..14fdd53 100644
--- a/src/MESA_handle_logger.c
+++ b/src/MESA_handle_logger.c
@@ -116,7 +116,7 @@ static void escape_for_zlog(char *in_buf, int buflen)
return;
}
-static void snapshot_handle_info(const char *handle_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];
if (g_zlog_conf_fp == -1)
@@ -133,13 +133,13 @@ static void snapshot_handle_info(const char *handle_name, int level)
return;
}
int len = snprintf(zlog_rule_conf_content, sizeof(zlog_rule_conf_content),
- "[global]\ndefault format = \"%%d(%%c), %%V, %U, %%m%%n\" \n[levels]\nDEBUG=10\nINFO=20\nFATAL=30\n[rules]");
+ "[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));
fsync(g_zlog_conf_fp);
}
snprintf(zlog_rule_conf_content, sizeof(zlog_rule_conf_content),
"\n%s.%d \"%s.%%d(%%F)\"",
- handle_name, level, handle_name);
+ handle_name, level, log_path);
write(g_zlog_conf_fp, zlog_rule_conf_content, strlen(zlog_rule_conf_content));
fsync(g_zlog_conf_fp);
return;
@@ -169,7 +169,7 @@ void *MESA_create_runtime_log_handle(const char *file_path, int level)
if (create_path(file_path, p_path_end - file_path) < 0)
return NULL;
- snapshot_handle_info(p_name, level);
+ snapshot_handle_info(p_name, file_path, level);
zc = zlog_get_category(p_name);
if (!zc)
{
@@ -205,7 +205,7 @@ void MESA_handle_runtime_log(void *handle, int level, const char *module, const
va_list ap;
va_start(ap, fmt);
- vzlog(p_handle->zc, __FILE__, sizeof(__FILE__) - 1, module, strlen(module), __LINE__, level, fmt, ap);
+ vzlog(p_handle->zc, p_handle->runtime_log_file, strlen(p_handle->runtime_log_file), module, strlen(module), __LINE__, level, fmt, ap);
va_end(ap);
return ;
}