Browse Source

修改默认日志配置文件

storage-in-realtime
zhaohe 12 months ago
parent
commit
6894bf6374
  1. 3
      .vscode/settings.json
  2. 16
      appdep/iflytop/core/spdlogfactory/logger_factory.cpp

3
.vscode/settings.json

@ -68,6 +68,7 @@
"codecvt": "cpp",
"bak": "c",
"any": "cpp",
"unordered_set": "cpp"
"unordered_set": "cpp",
"csignal": "cpp"
}
}

16
appdep/iflytop/core/spdlogfactory/logger_factory.cpp

@ -143,10 +143,8 @@ static string default_config = R"(
[
{
"name": "infologger",
"type": "daily_file_sink_mt",
"type": "rotating_file_sink_mt",
"filename": "logs/infolog.log",
"max_files": 3,
"rotate_on_open": true,
"level" : 2
},
{
@ -342,9 +340,9 @@ LOGGER_ENABLE_END(daily_logger_mt)
LOGGER_ENABLE_BEGIN(rotating_logger_mt) {
GET(string, filename);
mkdirIfNotExist(filename);
TRY_GET(int, max_file_size, 1000);
TRY_GET(int, max_files, 100);
TRY_GET(bool, rotate_on_open, false);
TRY_GET(int, max_file_size, 1024*1024);
TRY_GET(int, max_files, 3);
TRY_GET(bool, rotate_on_open, true);
var_logger = spdlog::rotating_logger_mt(name, filename, max_file_size, max_files, rotate_on_open);
}
LOGGER_ENABLE_END(rotating_logger_mt)
@ -399,9 +397,9 @@ SINK_DEFINE_END(daily_file_sink_mt)
SINK_DEFINE_BEGIN(rotating_file_sink_mt) {
GET(string, filename);
mkdirIfNotExist(filename);
TRY_GET(int, max_file_size, 1000);
TRY_GET(int, max_files, 100);
TRY_GET(bool, rotate_on_open, false);
TRY_GET(int, max_file_size, 1024*1024);
TRY_GET(int, max_files, 3);
TRY_GET(bool, rotate_on_open, true);
sink = make_shared<sinks::rotating_file_sink_mt>(filename, max_file_size, max_files, rotate_on_open);
}
SINK_DEFINE_END(rotating_file_sink_mt)

Loading…
Cancel
Save