diff options
author | saturneric <[email protected]> | 2023-02-04 06:02:49 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-02-04 06:02:49 +0000 |
commit | 8c2e8e37505058bb2448ba65021f616ca658927b (patch) | |
tree | 919b0124932a5ee7dce940595c46f087f2d763cc /src/ui/GpgFrontendUIInit.cpp | |
parent | fix: solve some issues (diff) | |
download | GpgFrontend-8c2e8e37505058bb2448ba65021f616ca658927b.tar.gz GpgFrontend-8c2e8e37505058bb2448ba65021f616ca658927b.zip |
fix: solve open file issue in menu bar
1. add flush policy for logger
2. seperate the name of each logger
3. replace the old open file logic with the new one when click the button on the menu bar
Diffstat (limited to 'src/ui/GpgFrontendUIInit.cpp')
-rw-r--r-- | src/ui/GpgFrontendUIInit.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp index 8beecea9..210d1088 100644 --- a/src/ui/GpgFrontendUIInit.cpp +++ b/src/ui/GpgFrontendUIInit.cpp @@ -150,7 +150,7 @@ void init_logging_system() { // logger auto ui_logger = std::make_shared<spdlog::async_logger>( - "core", begin(sinks), end(sinks), spdlog::thread_pool()); + "ui", begin(sinks), end(sinks), spdlog::thread_pool()); ui_logger->set_pattern( "[%H:%M:%S.%e] [T:%t] [%=4n] %^[%=8l]%$ [%s:%#] [%!] -> %v (+%ius)"); @@ -160,6 +160,13 @@ void init_logging_system() { core_logger->set_level(spdlog::level::info); #endif + // flush policy + ui_logger->flush_on(spdlog::level::err); + spdlog::flush_every(std::chrono::seconds(5)); + + // register it + spdlog::register_logger(ui_logger); + // register it as default logger spdlog::set_default_logger(ui_logger); } |