OCT 1. 启动时判断log配置文件是否存在,并打印提示信息

This commit is contained in:
huangxin 2023-02-06 10:13:49 +08:00
parent c4c3b5bf81
commit bf05af5140
1 changed files with 9 additions and 5 deletions

View File

@ -76,12 +76,16 @@ int user_init(const char *pAppCfgFile, const char *pCfgDirectory, const char *pK
utstring_new(pPath); utstring_new(pPath);
utstring_printf(pPath, "%s/%s", bufCfgDir, "zlog.conf"); utstring_printf(pPath, "%s/%s", bufCfgDir, "zlog.conf");
if ((ret = dzlog_init(utstring_body(pPath), get_cur_process_name())) != ERR_SUCCESS) { if (file_exists(utstring_body(pPath))) {
printf("Zlog configure file [%s] init result: %d+++++\n", utstring_body(pPath), ret); if ((ret = dzlog_init(utstring_body(pPath), get_cur_process_name())) != ERR_SUCCESS) {
zlog_profile(); printf("Zlog configure file [%s] init result: %d+++++\n", utstring_body(pPath), ret);
return -ERR_ZLOG_INIT; zlog_profile();
return -ERR_ZLOG_INIT;
} else {
dzlog_info("Zlog used configure file [%s]\n", utstring_body(pPath));
}
} else { } else {
dzlog_info("Zlog used configure file [%s]\n", utstring_body(pPath)); printf("Zlog configure file [%s] not found, Zlog system not work+++++\n", utstring_body(pPath));
} }
zlog_level_switch(zlog_get_category(get_cur_process_name()), zlog_level_switch(zlog_get_category(get_cur_process_name()),