diff --git a/src/gui/state/loot_paths.cpp b/src/gui/state/loot_paths.cpp index 1a232ea9..d849b46e 100644 --- a/src/gui/state/loot_paths.cpp +++ b/src/gui/state/loot_paths.cpp @@ -66,6 +66,10 @@ boost::filesystem::path LootPaths::getLogPath() { return lootDataPath_ / "LOOTDebugLog.txt"; } +boost::filesystem::path LootPaths::getApiLogPath() { + return lootDataPath_ / "LOOTAPIDebugLog.txt"; +} + void LootPaths::initialise(const std::string& lootDataPath) { // Set the locale to get UTF-8 conversions working correctly. std::locale::global(boost::locale::generator().generate("")); diff --git a/src/gui/state/loot_paths.h b/src/gui/state/loot_paths.h index 38a08715..9f560331 100644 --- a/src/gui/state/loot_paths.h +++ b/src/gui/state/loot_paths.h @@ -36,6 +36,7 @@ public: static boost::filesystem::path getLootDataPath(); static boost::filesystem::path getSettingsPath(); static boost::filesystem::path getLogPath(); + static boost::filesystem::path getApiLogPath(); // Sets the app path to the current path, and the data path to the given // path or (if it is an empty string), local app data path / "LOOT". diff --git a/src/gui/state/loot_state.cpp b/src/gui/state/loot_state.cpp index c9ff8363..d635295c 100644 --- a/src/gui/state/loot_state.cpp +++ b/src/gui/state/loot_state.cpp @@ -36,9 +36,7 @@ #include #include "gui/state/loot_paths.h" -#include "loot/exception/game_detection_error.h" -#include "loot/language.h" -#include "loot/loot_version.h" +#include "loot/api.h" #include "loot/windows_encoding_converters.h" #ifdef _WIN32 @@ -152,6 +150,7 @@ void LootState::init(const std::string& cmdLineGame) { ) ); boost::log::add_common_attributes(); + SetLogFile(LootPaths::getApiLogPath().string()); enableDebugLogging(isDebugLoggingEnabled()); // Log some useful info. @@ -282,8 +281,10 @@ void LootState::selectGame(std::string preferredGame) { void LootState::enableDebugLogging(bool enable) { if (enable) { boost::log::core::get()->reset_filter(); + SetLoggingVerbosity(LogVerbosity::trace); } else { boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::warning); + SetLoggingVerbosity(LogVerbosity::warning); } }