Debug logging control is now a toggle only.

Closes #263. This is a breaking change for previous alpha users.
This commit is contained in:
WrinklyNinja
2014-08-28 21:51:44 +01:00
parent 21e4bc84ee
commit 1c5ba077e0
3 changed files with 18 additions and 32 deletions
+2 -2
View File
@@ -196,7 +196,7 @@ var loot = {
gameSelect.value = this.settings.game;
document.getElementById('languageSelect').value = this.settings.language;
document.getElementById('debugVerbositySelect').value = this.settings.debugVerbosity;
document.getElementById('enableDebugLogging').checked = this.settings.enableDebugLogging;
document.getElementById('updateMasterlist').checked = this.settings.updateMasterlist;
this.updateEnabledGames();
@@ -1032,7 +1032,7 @@ function closeSettingsDialog(evt) {
if (evt.target.classList.contains('accept')) {
/* Update the JS variable values. */
var settings = {
debugVerbosity: document.getElementById('debugVerbositySelect').value,
enableDebugLogging: document.getElementById('enableDebugLogging').checked,
game: document.getElementById('defaultGameSelect').value,
games: document.getElementById('gameTable').getRowsData(false),
language: document.getElementById('languageSelect').value,
+2 -8
View File
@@ -541,13 +541,8 @@ along with LOOT. If not, see <http://www.gnu.org/licenses/>.
<select id="languageSelect">
<!-- Language <option> elements go here. -->
</select><br>
<label for="debugVerbositySelect" title="The output is logged to the LOOTDebugLog.txt file.">Debug Verbosity</label>
<select id="debugVerbositySelect">
<option value="0">None</option>
<option value="1">Low</option>
<option value="2">Medium</option>
<option value="3">High</option>
</select>
<p><input type="checkbox" id="enableDebugLogging"><label for="enableDebugLogging" title="The output is logged to the LOOTDebugLog.txt file.">Enable debug logging</label>
<p><input type="checkbox" id="updateMasterlist"><label for="updateMasterlist">Update masterlist before sorting</label>
<table is="editable-table" id="gameTable" data-template="gameRow">
<thead>
<tr><th>Name<th>Base Game<th>LOOT Folder<th>Master File<th>Masterlist Repository URL<th>Masterlist Repository Branch<th>Install Path<th>Install Path Registry Key<th>
@@ -555,7 +550,6 @@ along with LOOT. If not, see &lt;http://www.gnu.org/licenses/&gt;.
<!-- Game rows go here. -->
<tr><td colspan="4">Add new row...</td><td></td></tr>
</table>
<p><input type="checkbox" id="updateMasterlist"><label for="updateMasterlist">Update masterlist before sorting</label>
<p>Language changes will be applied after LOOT is restarted.
<hr>
<div class="buttons">
+14 -22
View File
@@ -160,29 +160,21 @@ namespace loot {
boost::log::keywords::file_name = g_path_log.string().c_str(),
boost::log::keywords::auto_flush = true,
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::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();
unsigned int verbosity;
if (_settings["debugVerbosity"]) {
verbosity = _settings["debugVerbosity"].as<unsigned int>();
bool enableDebugLogging = false;
if (_settings["enableDebugLogging"]) {
enableDebugLogging = _settings["enableDebugLogging"].as<bool>();
}
if (verbosity == 0)
boost::log::core::get()->set_logging_enabled(false);
else {
if (enableDebugLogging)
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.
}
else
boost::log::core::get()->set_logging_enabled(false);
BOOST_LOG_TRIVIAL(info) << "LOOT Version: " << g_version_major << "." << g_version_minor << "." << g_version_patch;
// The CEF debug log is appended to, not overwritten, so it gets really long.
@@ -350,10 +342,10 @@ namespace loot {
else
return false;
}
if (!_settings["debugVerbosity"]) {
if (!_settings["enableDebugLogging"]) {
if (_settings["Debug Verbosity"]) {
// Conversion from 0.6 key.
_settings["debugVerbosity"] = _settings["Debug Verbosity"];
_settings["enableDebugLogging"] = (_settings["Debug Verbosity"].as<unsigned int>() > 0);
_settings.remove("Debug Verbosity");
}
else
@@ -398,7 +390,7 @@ namespace loot {
root["language"] = "en";
root["game"] = "auto";
root["lastGame"] = "auto";
root["debugVerbosity"] = 0;
root["enableDebugLogging"] = false;
root["updateMasterlist"] = true;
std::vector<Game> games;