From 6894bf637480fb5ef0ae398e3544ba84ffbb44ca Mon Sep 17 00:00:00 2001 From: zhaohe Date: Thu, 22 Aug 2024 13:16:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 3 ++- appdep/iflytop/core/spdlogfactory/logger_factory.cpp | 16 +++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 81d0527..6d21eea 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -68,6 +68,7 @@ "codecvt": "cpp", "bak": "c", "any": "cpp", - "unordered_set": "cpp" + "unordered_set": "cpp", + "csignal": "cpp" } } \ No newline at end of file diff --git a/appdep/iflytop/core/spdlogfactory/logger_factory.cpp b/appdep/iflytop/core/spdlogfactory/logger_factory.cpp index c8b3a57..34b416e 100644 --- a/appdep/iflytop/core/spdlogfactory/logger_factory.cpp +++ b/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(filename, max_file_size, max_files, rotate_on_open); } SINK_DEFINE_END(rotating_file_sink_mt)