diff --git a/larigira/config.py b/larigira/config.py index 6eed424..6ee6ef5 100644 --- a/larigira/config.py +++ b/larigira/config.py @@ -24,6 +24,7 @@ def get_conf(prefix='LARIGIRA_'): conf['MPD_WAIT_START'] = True conf['MPD_WAIT_START_RETRYSECS'] = 5 conf['CHECK_SECS'] = 20 + conf['DEBUG'] = False conf.update(from_envvars(prefix=prefix)) return conf diff --git a/larigira/event.py b/larigira/event.py index 78ffb50..3a5c014 100644 --- a/larigira/event.py +++ b/larigira/event.py @@ -2,10 +2,6 @@ from __future__ import print_function from gevent import monkey monkey.patch_all(subprocess=True) import logging -FORMAT = '%(asctime)s|%(levelname)s[%(name)s:%(lineno)d] %(message)s' -logging.basicConfig(level=logging.INFO, - format=FORMAT, - datefmt='%H:%M:%S') logging.getLogger('mpd').setLevel(logging.WARNING) from datetime import datetime, timedelta diff --git a/larigira/larigira.py b/larigira/larigira.py index 1f0af2f..58ce116 100644 --- a/larigira/larigira.py +++ b/larigira/larigira.py @@ -11,10 +11,6 @@ import tempfile import signal from time import sleep import logging -FORMAT = '%(asctime)s|%(levelname)s[%(name)s:%(lineno)d] %(message)s' -logging.basicConfig(level=logging.INFO, - format=FORMAT, - datefmt='%H:%M:%S') import gevent from gevent.wsgi import WSGIServer @@ -52,7 +48,10 @@ class Larigira(object): def main(): os.environ['TMPDIR'] = tempfile.mkdtemp(prefix='larigira') - logging.basicConfig(level=logging.DEBUG) + log_format = '%(asctime)s|%(levelname)s[%(name)s:%(lineno)d] %(message)s' + logging.basicConfig(level=logging.DEBUG if get_conf()['DEBUG'] else logging.INFO, + format=log_format, + datefmt='%H:%M:%S') if(get_conf()['MPD_WAIT_START']): while True: try: