log level controlled by DEBUG

This commit is contained in:
boyska 2016-09-08 23:38:49 +02:00
parent 284a3fa029
commit dfa910a642
No known key found for this signature in database
GPG key ID: 7395DCAE58289CA9
3 changed files with 5 additions and 9 deletions

View file

@ -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

View file

@ -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

View file

@ -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: