diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index a21af8bb..7802977f 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -144,6 +144,10 @@ public: initialization_in_progress_suppress_logging = false; } + static bool IsActive() { + return instance != nullptr; + } + static void Start() { instance->StartBackendThread(); } @@ -275,6 +279,10 @@ void Initialize(std::string_view log_file) { Impl::Initialize(log_file.empty() ? LOG_FILE : log_file); } +bool IsActive() { + return Impl::IsActive(); +} + void Start() { Impl::Start(); } diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h index 91c9da83..a1ad6636 100644 --- a/src/common/logging/backend.h +++ b/src/common/logging/backend.h @@ -13,6 +13,8 @@ class Filter; /// Initializes the logging system. This should be the first thing called in main. void Initialize(std::string_view log_file = ""); +bool IsActive(); + /// Starts the logging threads. void Start(); diff --git a/src/qt_gui/settings_dialog.cpp b/src/qt_gui/settings_dialog.cpp index 4206c446..720c68b7 100644 --- a/src/qt_gui/settings_dialog.cpp +++ b/src/qt_gui/settings_dialog.cpp @@ -4,6 +4,8 @@ #include #include +#include "common/logging/backend.h" +#include "common/logging/filter.h" #include "main_window.h" #include "settings_dialog.h" #include "ui_settings_dialog.h" @@ -78,6 +80,11 @@ SettingsDialog::SettingsDialog(std::span physical_devices, QWidge Config::setDefaultValues(); LoadValuesFromConfig(); } + if (Common::Log::IsActive()) { + Common::Log::Filter filter; + filter.ParseFilterString(Config::getLogFilter()); + Common::Log::SetGlobalFilter(filter); + } }); ui->buttonBox->button(QDialogButtonBox::Save)->setText(tr("Save"));