diff options
author | saturneric <[email protected]> | 2024-01-12 15:08:38 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-01-12 15:08:38 +0000 |
commit | 6983b5c1dd82d159236ebd06cf17f071cc9c1ee9 (patch) | |
tree | fc53f790e33546320b2ecd306a1a9ade6fbdfe7a /src/core/function/LoggerManager.cpp | |
parent | fix: slove a heap-use-after-free issue (diff) | |
download | GpgFrontend-6983b5c1dd82d159236ebd06cf17f071cc9c1ee9.tar.gz GpgFrontend-6983b5c1dd82d159236ebd06cf17f071cc9c1ee9.zip |
refactor: remove boost and use QString instead of std::filesystem::path
Diffstat (limited to 'src/core/function/LoggerManager.cpp')
-rw-r--r-- | src/core/function/LoggerManager.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/core/function/LoggerManager.cpp b/src/core/function/LoggerManager.cpp index c800224a..3b88e4f0 100644 --- a/src/core/function/LoggerManager.cpp +++ b/src/core/function/LoggerManager.cpp @@ -70,8 +70,7 @@ auto LoggerManager::RegisterAsyncLogger(const QString& id, -> std::shared_ptr<spdlog::logger> { // get the log directory auto log_file_path = - (GlobalSettingStation::GetInstance().GetLogDir() / id.toStdString()); - log_file_path.replace_extension(".log"); + GlobalSettingStation::GetInstance().GetLogDir() + "/" + id + ".log"; // sinks std::vector<spdlog::sink_ptr> sinks; @@ -79,7 +78,7 @@ auto LoggerManager::RegisterAsyncLogger(const QString& id, spdlog::sinks::stderr_color_sink_mt>()); sinks.push_back(GpgFrontend::SecureCreateSharedObject< spdlog::sinks::rotating_file_sink_mt>( - log_file_path.u8string(), 1048576 * 32, 8)); + log_file_path.toUtf8().constData(), 1048576 * 32, 8)); // logger auto logger = GpgFrontend::SecureCreateSharedObject<spdlog::async_logger>( @@ -106,8 +105,7 @@ auto LoggerManager::RegisterSyncLogger(const QString& id, -> std::shared_ptr<spdlog::logger> { // get the log directory auto log_file_path = - (GlobalSettingStation::GetInstance().GetLogDir() / id.toStdString()); - log_file_path.replace_extension(".log"); + GlobalSettingStation::GetInstance().GetLogDir() + "/" + id + ".log"; // sinks std::vector<spdlog::sink_ptr> sinks; @@ -115,7 +113,7 @@ auto LoggerManager::RegisterSyncLogger(const QString& id, spdlog::sinks::stderr_color_sink_mt>()); sinks.push_back(GpgFrontend::SecureCreateSharedObject< spdlog::sinks::rotating_file_sink_mt>( - log_file_path.u8string(), 1048576 * 32, 8)); + log_file_path.toUtf8().constData(), 1048576 * 32, 8)); // logger auto logger = GpgFrontend::SecureCreateSharedObject<spdlog::logger>( |