Change Log_level settings to Debug checkbox

pull/249/head
Halali 6 years ago
parent 1b8efc890a
commit 5ff8baa19c

@ -39,10 +39,10 @@ def get_general_settings():
else:
path_mappings = '[]'
if cfg.has_option('general', 'log_level'):
log_level = cfg.get('general', 'log_level')
if cfg.has_option('general', 'debug'):
debug = cfg.getboolean('general', 'debug')
else:
log_level = 'INFO'
debug = False
if cfg.has_option('general', 'branch'):
branch = cfg.get('general', 'branch')
@ -154,7 +154,7 @@ def get_general_settings():
port = '6767'
base_url = '/'
path_mappings = '[]'
log_level = 'INFO'
debug = False
branch = 'master'
auto_update = True
single_language = False
@ -177,7 +177,7 @@ def get_general_settings():
only_monitored = False
adaptive_searching = False
return [ip, port, base_url, path_mappings, log_level, branch, auto_update, single_language, minimum_score, use_scenename, use_postprocessing, postprocessing_cmd, use_sonarr, use_radarr, path_mappings_movie, serie_default_enabled, serie_default_language, serie_default_hi, movie_default_enabled,movie_default_language, movie_default_hi, page_size, minimum_score_movie, use_embedded_subs, only_monitored, adaptive_searching]
return [ip, port, base_url, path_mappings, debug, branch, auto_update, single_language, minimum_score, use_scenename, use_postprocessing, postprocessing_cmd, use_sonarr, use_radarr, path_mappings_movie, serie_default_enabled, serie_default_language, serie_default_hi, movie_default_enabled,movie_default_language, movie_default_hi, page_size, minimum_score_movie, use_embedded_subs, only_monitored, adaptive_searching]
def get_auth_settings():
@ -450,7 +450,7 @@ ip = result[0]
port = result[1]
base_url = result[2]
path_mappings = ast.literal_eval(result[3])
log_level = result[4]
debug = result[4]
branch = result[5]
automatic = result[6]
single_language = result[7]

@ -66,6 +66,13 @@ if cfg.has_section('auth'):
cfg.remove_option('auth', 'enabled')
with open(config_file, 'w+') as configfile:
cfg.write(configfile)
if cfg.has_section('general'):
if cfg.has_option('general', 'log_level'):
cfg.remove_option('general', 'log_level')
cfg.set('general', 'debug', 'False')
with open(config_file, 'w+') as configfile:
cfg.write(configfile)
from cork import Cork
import time

@ -7,10 +7,11 @@ from logging.handlers import TimedRotatingFileHandler
from get_argv import config_dir
from get_settings import get_general_settings
log_level = get_general_settings()[4]
if log_level is None:
debug = get_general_settings()[4]
if debug is False:
log_level = "INFO"
else:
log_level = "DEBUG"
class OneLineExceptionFormatter(logging.Formatter):
def formatException(self, exc_info):
@ -48,7 +49,7 @@ def configure_logging():
fh.setFormatter(f)
fh.addFilter(BlacklistFilter())
if log_level == 'debug':
if debug is True:
logging.getLogger("apscheduler").setLevel(logging.DEBUG)
logging.getLogger("subliminal").setLevel(logging.DEBUG)
logging.getLogger("git").setLevel(logging.DEBUG)
@ -63,11 +64,19 @@ def configure_logging():
logging.getLogger("stevedore.extension").setLevel(logging.CRITICAL)
log.setLevel(log_level)
log.addHandler(fh)
# Console logging
ch = logging.StreamHandler()
cf = NoExceptionFormatter('%(asctime)s - %(levelname)s :: %(message)s',
'%Y-%m-%d %H:%M:%S')
ch.setFormatter(cf)
logging.getLogger("apscheduler").setLevel(logging.WARNING)
logging.getLogger("subliminal").setLevel(logging.CRITICAL)
logging.getLogger("enzyme").setLevel(logging.CRITICAL)
logging.getLogger("guessit").setLevel(logging.WARNING)
logging.getLogger("rebulk").setLevel(logging.WARNING)
logging.getLogger("stevedore.extension").setLevel(logging.CRITICAL)
ch.setLevel(logging.INFO)
log.addHandler(ch)

@ -1029,7 +1029,11 @@ def save_settings():
settings_general_baseurl = request.forms.get('settings_general_baseurl')
if settings_general_baseurl.endswith('/') is False:
settings_general_baseurl += '/'
settings_general_loglevel = request.forms.get('settings_general_loglevel')
settings_general_debug = request.forms.get('settings_general_debug')
if settings_general_debug is None:
settings_general_debug = 'False'
else:
settings_general_debug = 'True'
settings_general_sourcepath = request.forms.getall('settings_general_sourcepath')
settings_general_destpath = request.forms.getall('settings_general_destpath')
settings_general_pathmapping = []
@ -1092,7 +1096,7 @@ def save_settings():
settings_general = get_general_settings()
before = (unicode(settings_general[0]), int(settings_general[1]), unicode(settings_general[2]), unicode(settings_general[4]), unicode(settings_general[3]), unicode(settings_general[12]), unicode(settings_general[13]), unicode(settings_general[14]))
after = (unicode(settings_general_ip), int(settings_general_port), unicode(settings_general_baseurl), unicode(settings_general_loglevel), unicode(settings_general_pathmapping), unicode(settings_general_use_sonarr), unicode(settings_general_use_radarr), unicode(settings_general_pathmapping_movie))
after = (unicode(settings_general_ip), int(settings_general_port), unicode(settings_general_baseurl), unicode(settings_general_debug), unicode(settings_general_pathmapping), unicode(settings_general_use_sonarr), unicode(settings_general_use_radarr), unicode(settings_general_pathmapping_movie))
from six import text_type
cfg = ConfigParser()
@ -1104,7 +1108,7 @@ def save_settings():
cfg.set('general', 'port', text_type(settings_general_port))
cfg.set('general', 'base_url', text_type(settings_general_baseurl))
cfg.set('general', 'path_mappings', text_type(settings_general_pathmapping))
cfg.set('general', 'log_level', text_type(settings_general_loglevel))
cfg.set('general', 'debug', text_type(settings_general_debug))
cfg.set('general', 'branch', text_type(settings_general_branch))
cfg.set('general', 'auto_update', text_type(settings_general_automatic))
cfg.set('general', 'single_language', text_type(settings_general_single_language))

@ -135,17 +135,13 @@
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Log Level</label>
<label>Enable debug logging</label>
</div>
<div class="five wide column">
<select name="settings_general_loglevel" id="settings_loglevel" class="ui fluid selection dropdown">
<option value="">Log Level</option>
<option value="DEBUG">Debug</option>
<option value="INFO">Info</option>
<option value="WARNING">Warning</option>
<option value="ERROR">Error</option>
<option value="CRITICAL">Critical</option>
</select>
<div id="settings_debug" class="ui toggle checkbox" data-debug={{settings_general[4]}}>
<input name="settings_general_debug" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed center aligned column">
@ -1410,6 +1406,12 @@
$("#settings_automatic_div").checkbox('uncheck');
}
if ($('#settings_debug').data("debug") == "True") {
$("#settings_debug").checkbox('check');
} else {
$("#settings_debug").checkbox('uncheck');
}
if ($('#settings_single_language').data("single-language") == "True") {
$("#settings_single_language").checkbox('check');
} else {

Loading…
Cancel
Save