mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Always log errors and warnings
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user