Always log errors and warnings

This commit is contained in:
Oliver Hamlet
2016-12-15 18:07:20 +00:00
parent d5698a8ff9
commit ef5d755dad
3 changed files with 13 additions and 4 deletions
+10 -2
View File
@@ -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<string> 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<Game> LootState::toGames(const std::vector<GameSettings>& settings) {
return std::list<Game>(settings.begin(), settings.end());
}
+2 -1
View File
@@ -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<Game> toGames(const std::vector<GameSettings>& settings);
static std::vector<GameSettings> toGameSettings(const std::list<Game>& games);
+1 -1
View File
@@ -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());
}
}