diff --git a/bazarr/get_settings.py b/bazarr/get_settings.py index ebe291686..038cbb583 100644 --- a/bazarr/get_settings.py +++ b/bazarr/get_settings.py @@ -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] diff --git a/bazarr/init.py b/bazarr/init.py index 8078a48a1..633b9347b 100644 --- a/bazarr/init.py +++ b/bazarr/init.py @@ -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 diff --git a/bazarr/logger.py b/bazarr/logger.py index 9173fedd9..c558d554f 100644 --- a/bazarr/logger.py +++ b/bazarr/logger.py @@ -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) diff --git a/bazarr/main.py b/bazarr/main.py index ba8d62636..782748fc3 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -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)) diff --git a/views/settings.tpl b/views/settings.tpl index b698ce56b..fac299492 100644 --- a/views/settings.tpl +++ b/views/settings.tpl @@ -135,17 +135,13 @@
- +
- +
+ + +