mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Changed debug settings handling.
Tidied up init on app startup, and settings are now applied immediately on settings window exit, instead of requiring an app restart.
This commit is contained in:
+23
-19
@@ -196,27 +196,31 @@ bool BossGUI::OnInit() {
|
||||
}
|
||||
|
||||
//Set up logging.
|
||||
unsigned int verbosity = _settings["Debug Verbosity"].as<unsigned int>();
|
||||
if (verbosity > 0) {
|
||||
boost::log::add_file_log(
|
||||
boost::log::keywords::file_name = g_path_log.string().c_str(),
|
||||
boost::log::keywords::format = (
|
||||
boost::log::expressions::stream
|
||||
<< "[" << boost::log::expressions::format_date_time< boost::posix_time::ptime >("TimeStamp", "%H:%M:%S") << "]"
|
||||
<< " [" << boost::log::trivial::severity << "]: "
|
||||
<< boost::log::expressions::smessage
|
||||
)
|
||||
);
|
||||
if (verbosity == 1)
|
||||
boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::warning); //Log all warnings, errors and fatals.
|
||||
else if (verbosity == 2)
|
||||
boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::debug); //Log debugs, infos, warnings, errors and fatals.
|
||||
boost::log::add_file_log(
|
||||
boost::log::keywords::file_name = g_path_log.string().c_str(),
|
||||
boost::log::keywords::format = (
|
||||
boost::log::expressions::stream
|
||||
<< "[" << boost::log::expressions::format_date_time< boost::posix_time::ptime >("TimeStamp", "%H:%M:%S") << "]"
|
||||
<< " [" << boost::log::trivial::severity << "]: "
|
||||
<< boost::log::expressions::smessage
|
||||
)
|
||||
);
|
||||
boost::log::add_common_attributes();
|
||||
if (_settings["Debug Verbosity"]) {
|
||||
unsigned int verbosity = _settings["Debug Verbosity"].as<unsigned int>();
|
||||
if (verbosity == 0)
|
||||
boost::log::core::get()->set_logging_enabled(false);
|
||||
else {
|
||||
boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::trace); //Log everything.
|
||||
boost::log::core::get()->set_logging_enabled(true);
|
||||
|
||||
if (verbosity == 1)
|
||||
boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::warning); //Log all warnings, errors and fatals.
|
||||
else if (verbosity == 2)
|
||||
boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::debug); //Log debugs, infos, warnings, errors and fatals.
|
||||
else
|
||||
boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::trace); //Log everything.
|
||||
}
|
||||
boost::log::add_common_attributes();
|
||||
} else
|
||||
boost::log::core::get()->set_logging_enabled(false); //Disable all logging.
|
||||
}
|
||||
|
||||
//Specify location of language dictionaries
|
||||
boost::locale::generator gen;
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
#include "../backend/globals.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
#include <boost/log/core.hpp>
|
||||
#include <boost/log/expressions.hpp>
|
||||
#include <boost/log/utility/setup/file.hpp>
|
||||
#include <boost/log/utility/setup/common_attributes.hpp>
|
||||
#include <boost/log/support/date_time.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -208,6 +213,20 @@ void SettingsFrame::OnQuit(wxCommandEvent& event) {
|
||||
|
||||
_settings["Debug Verbosity"] = DebugVerbosityChoice->GetSelection();
|
||||
|
||||
unsigned int verbosity = _settings["Debug Verbosity"].as<unsigned int>();
|
||||
if (verbosity == 0)
|
||||
boost::log::core::get()->set_logging_enabled(false);
|
||||
else {
|
||||
boost::log::core::get()->set_logging_enabled(true);
|
||||
|
||||
if (verbosity == 1)
|
||||
boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::warning); //Log all warnings, errors and fatals.
|
||||
else if (verbosity == 2)
|
||||
boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::debug); //Log debugs, infos, warnings, errors and fatals.
|
||||
else
|
||||
boost::log::core::get()->set_filter(boost::log::trivial::severity >= boost::log::trivial::trace); //Log everything.
|
||||
}
|
||||
|
||||
_settings["Update Masterlist"] = UpdateMasterlistBox->IsChecked();
|
||||
|
||||
_settings["View Report Externally"] = reportViewBox->IsChecked();
|
||||
|
||||
Reference in New Issue
Block a user