0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-24 01:57:56 +01:00

Only show warning about verbose logging when level is set to verbose or bulk.

Small improvements to when log level warnings are shown.
This commit is contained in:
Wouter R 2016-01-06 16:38:59 +01:00
parent 25c51c3e5c
commit 46bcd54a1a
2 changed files with 21 additions and 8 deletions

View File

@ -35,7 +35,7 @@ function SettingsWindow() {
var _networkAPI = new NetworkAPI(); var _networkAPI = new NetworkAPI();
var _restoreStateField; var _restoreStateField;
var _initialLogLevel; var _initialLogLevel = undefined;
var self = this; var self = this;
@ -124,7 +124,12 @@ function SettingsWindow() {
_form.loadAllSettings(function(loadedSettings){ _form.loadAllSettings(function(loadedSettings){
console.log("Settings:loaded settings: ",loadedSettings); console.log("Settings:loaded settings: ",loadedSettings);
settings = loadedSettings; settings = loadedSettings;
_initialLogLevel = loadedSettings['system.log.level'];
//only set the initial level once, to make behaviour of restart warning as correctly as possible
if (_initialLogLevel == undefined)
_initialLogLevel = loadedSettings['system.log.level'];
updateLogLevelWarningsVisibility();
_form.fillForm(settings); _form.fillForm(settings);
$(document).trigger(SettingsWindow.SETTINGS_LOADED); $(document).trigger(SettingsWindow.SETTINGS_LOADED);
if(complete) complete(); if(complete) complete();
@ -183,16 +188,24 @@ function SettingsWindow() {
location.href = "filemanager/"+location.search; location.href = "filemanager/"+location.search;
} }
this.logLevelChanged = function(elem) { this.logLevelChanged = function() {
updateLogLevelWarningsVisibility();
}
/***** LOCAL FUNCTIONS *****/
function updateLogLevelWarningsVisibility() {
var showHideAnimDuration = 100; var showHideAnimDuration = 100;
if (_initialLogLevel != elem.value) { newLevel = $('#logLevel').val();
if (_initialLogLevel != newLevel) {
$('#logging-restart-warning').show(showHideAnimDuration); $('#logging-restart-warning').show(showHideAnimDuration);
} else { } else {
$('#logging-restart-warning').hide(showHideAnimDuration); $('#logging-restart-warning').hide(showHideAnimDuration);
} }
switch (elem.value) { switch (newLevel) {
case "info": case "verbose": case "bulk": case "verbose": case "bulk":
$('#logging-verbose-warning').show(showHideAnimDuration); $('#logging-verbose-warning').show(showHideAnimDuration);
break; break;
default: default:

View File

@ -183,7 +183,7 @@
<fieldset id="debugPanel"> <fieldset id="debugPanel">
<legend>Debug</legend> <legend>Debug</legend>
<label for="logLevel">Log level:</label> <label for="logLevel">Log level:</label>
<select id="logLevel" name="system.log.level" onchange="settingsWindow.logLevelChanged(this)"> <select id="logLevel" name="system.log.level" onchange="settingsWindow.logLevelChanged()">
<option value="" disabled="disabled" selected="selected">Please choose a log level</option> <option value="" disabled="disabled" selected="selected">Please choose a log level</option>
<option value="quiet">Quiet</option> <option value="quiet">Quiet</option>
<option value="error">Error</option> <option value="error">Error</option>
@ -193,7 +193,7 @@
<option value="bulk">Bulk</option> <option value="bulk">Bulk</option>
</select><br/> </select><br/>
<div id="logging-restart-warning" class="warn-box"> <div id="logging-restart-warning" class="warn-box">
Restart the wifibox for a new log level to take effect. Restart the wifibox for the new log level to take effect.
</div> </div>
<div id="logging-verbose-warning" class="warn-box"> <div id="logging-verbose-warning" class="warn-box">
<em>Be careful</em>: when setting a log level higher than info, the Wifibox may quickly run out of memory, causing crashes and other unwanted behaviour. <em>Be careful</em>: when setting a log level higher than info, the Wifibox may quickly run out of memory, causing crashes and other unwanted behaviour.