diff options
author | saturneric <[email protected]> | 2024-01-05 12:55:15 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-01-05 12:55:15 +0000 |
commit | 644aa4397b03dbef73f8bfedc13925b51cad836b (patch) | |
tree | 7788d1cd2f0687dd8e576b111d9990c580092e7a /src/core/function/GlobalSettingStation.cpp | |
parent | fix: slove some known issues (diff) | |
download | GpgFrontend-644aa4397b03dbef73f8bfedc13925b51cad836b.tar.gz GpgFrontend-644aa4397b03dbef73f8bfedc13925b51cad836b.zip |
feat: integrate logging api to core
Diffstat (limited to 'src/core/function/GlobalSettingStation.cpp')
-rw-r--r-- | src/core/function/GlobalSettingStation.cpp | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/src/core/function/GlobalSettingStation.cpp b/src/core/function/GlobalSettingStation.cpp index 6290e866..09dd1c90 100644 --- a/src/core/function/GlobalSettingStation.cpp +++ b/src/core/function/GlobalSettingStation.cpp @@ -43,10 +43,10 @@ class GlobalSettingStation::Impl { * */ explicit Impl() noexcept { - SPDLOG_INFO("app path: {}", app_path_.u8string()); + GF_CORE_LOG_INFO("app path: {}", app_path_.u8string()); auto portable_file_path = app_path_ / "PORTABLE.txt"; if (std::filesystem::exists(portable_file_path)) { - SPDLOG_INFO( + GF_CORE_LOG_INFO( "dectected portable mode, reconfiguring config and data path..."); Module::UpsertRTValue("core", "env.state.portable", 1); @@ -60,15 +60,15 @@ class GlobalSettingStation::Impl { app_data_objs_path_ = app_data_path_ / "data_objs"; } - SPDLOG_INFO("app configure path: {}", app_configure_path_.u8string()); - SPDLOG_INFO("app data path: {}", app_data_path_.u8string()); - SPDLOG_INFO("app log path: {}", app_log_path_.u8string()); - SPDLOG_INFO("app locale path: {}", app_locale_path_.u8string()); - SPDLOG_INFO("app conf path: {}", main_config_path_.u8string()); + GF_CORE_LOG_INFO("app configure path: {}", app_configure_path_.u8string()); + GF_CORE_LOG_INFO("app data path: {}", app_data_path_.u8string()); + GF_CORE_LOG_INFO("app log path: {}", app_log_path_.u8string()); + GF_CORE_LOG_INFO("app locale path: {}", app_locale_path_.u8string()); + GF_CORE_LOG_INFO("app conf path: {}", main_config_path_.u8string()); - SPDLOG_INFO("app log files total size: {}", GetLogFilesSize()); - SPDLOG_INFO("app data objects files total size: {}", - GetDataObjectsFilesSize()); + GF_CORE_LOG_INFO("app log files total size: {}", GetLogFilesSize()); + GF_CORE_LOG_INFO("app data objects files total size: {}", + GetDataObjectsFilesSize()); if (!is_directory(app_configure_path_)) { create_directory(app_configure_path_); @@ -80,24 +80,27 @@ class GlobalSettingStation::Impl { if (!exists(main_config_path_)) { try { this->ui_cfg_.writeFile(main_config_path_.u8string().c_str()); - SPDLOG_DEBUG("user interface configuration successfully written to {}", - main_config_path_.u8string()); + GF_CORE_LOG_DEBUG( + "user interface configuration successfully written to {}", + main_config_path_.u8string()); } catch (const libconfig::FileIOException &fioex) { - SPDLOG_DEBUG( + GF_CORE_LOG_DEBUG( "i/o error while writing UserInterface configuration file {}", main_config_path_.u8string()); } } else { try { this->ui_cfg_.readFile(main_config_path_.u8string().c_str()); - SPDLOG_DEBUG("user interface configuration successfully read from {}", - main_config_path_.u8string()); + GF_CORE_LOG_DEBUG( + "user interface configuration successfully read from {}", + main_config_path_.u8string()); } catch (const libconfig::FileIOException &fioex) { - SPDLOG_ERROR("i/o error while reading UserInterface configure file"); + GF_CORE_LOG_ERROR( + "i/o error while reading UserInterface configure file"); } catch (const libconfig::ParseException &pex) { - SPDLOG_ERROR("parse error at {} : {} - {}", pex.getFile(), - pex.getLine(), pex.getError()); + GF_CORE_LOG_ERROR("parse error at {} : {} - {}", pex.getFile(), + pex.getLine(), pex.getError()); } } } @@ -134,7 +137,7 @@ class GlobalSettingStation::Impl { try { value = static_cast<T>(GetMainSettings().lookup(path)); } catch (...) { - SPDLOG_WARN("setting not found: {}", path); + GF_CORE_LOG_WARN("setting not found: {}", path); } return value; } @@ -212,12 +215,12 @@ class GlobalSettingStation::Impl { void SyncSettings() noexcept { try { ui_cfg_.writeFile(main_config_path_.u8string().c_str()); - SPDLOG_DEBUG("updated ui configuration successfully written to {}", - main_config_path_.u8string()); + GF_CORE_LOG_DEBUG("updated ui configuration successfully written to {}", + main_config_path_.u8string()); } catch (const libconfig::FileIOException &fioex) { - SPDLOG_ERROR("i/o error while writing ui configuration file: {}", - main_config_path_.u8string()); + GF_CORE_LOG_ERROR("i/o error while writing ui configuration file: {}", + main_config_path_.u8string()); } } |