diff --git a/src/backend/app/loot_state.cpp b/src/backend/app/loot_state.cpp index 5d41b4de..74328e49 100644 --- a/src/backend/app/loot_state.cpp +++ b/src/backend/app/loot_state.cpp @@ -64,7 +64,7 @@ void LootState::load(YAML::Node& settings) { LootSettings::load(settings); // Enable/disable debug logging in case it has changed. - boost::log::core::get()->set_logging_enabled(isDebugLoggingEnabled()); + enableDebugLogging(isDebugLoggingEnabled()); // Update existing games, add new games. std::unordered_set newGameFolders; @@ -144,7 +144,7 @@ void LootState::init(const std::string& cmdLineGame) { ) ); boost::log::add_common_attributes(); - boost::log::core::get()->set_logging_enabled(isDebugLoggingEnabled()); + enableDebugLogging(isDebugLoggingEnabled()); // Log some useful info. BOOST_LOG_TRIVIAL(info) << "LOOT Version: " << LootVersion::major << "." << LootVersion::minor << "." << LootVersion::patch; @@ -271,6 +271,14 @@ void LootState::selectGame(std::string preferredGame) { } } +void LootState::enableDebugLogging(bool enable) { + if (enable) { + boost::log::core::get()->reset_filter(); + } else { + boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::warning); + } +} + std::list LootState::toGames(const std::vector& settings) { return std::list(settings.begin(), settings.end()); } diff --git a/src/backend/app/loot_state.h b/src/backend/app/loot_state.h index 815ed15f..d8bbe3ba 100644 --- a/src/backend/app/loot_state.h +++ b/src/backend/app/loot_state.h @@ -49,8 +49,9 @@ public: void incrementUnappliedChangeCounter(); void decrementUnappliedChangeCounter(); private: - // Select initial game. + // Select initial game. void selectGame(std::string cmdLineGame); + void enableDebugLogging(bool enable); static std::list toGames(const std::vector& settings); static std::vector toGameSettings(const std::list& games); diff --git a/src/gui/query/query.h b/src/gui/query/query.h index 7fde1510..5eede221 100644 --- a/src/gui/query/query.h +++ b/src/gui/query/query.h @@ -37,7 +37,7 @@ public: callback->Success(executeLogic()); } catch (std::exception &e) { BOOST_LOG_TRIVIAL(error) << e.what(); - callback->Failure(-1, boost::locale::translate("Oh no, something went wrong! If you've enabled debug logging in your settings, you can check your LOOTDebugLog.txt (you can get to it through the main menu) for more information.").str()); + callback->Failure(-1, boost::locale::translate("Oh no, something went wrong! You can check your LOOTDebugLog.txt (you can get to it through the main menu) for more information.").str()); } }