1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-09-19 10:51:04 +00:00

watcher: log to stderr when no logfile is set

This commit is contained in:
spl0k 2018-11-11 19:25:14 +01:00
parent f5bab00a1c
commit b195aca12f
2 changed files with 4 additions and 3 deletions

View File

@ -254,9 +254,10 @@ class SupysonicWatcher(object):
def run(self):
if self.__config.DAEMON['log_file']:
log_handler = TimedRotatingFileHandler(self.__config.DAEMON['log_file'], when = 'midnight')
log_handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(message)s"))
else:
log_handler = logging.NullHandler()
log_handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(message)s"))
log_handler = logging.StreamHandler()
log_handler.setFormatter(logging.Formatter("[%(levelname)s] %(message)s"))
logger.addHandler(log_handler)
if 'log_level' in self.__config.DAEMON:
level = getattr(logging, self.__config.DAEMON['log_level'].upper(), logging.NOTSET)

View File

@ -30,7 +30,7 @@ from ..testbase import TestConfig
class WatcherTestConfig(TestConfig):
DAEMON = {
'wait_delay': 0.5,
'log_file': None,
'log_file': '/dev/null',
'log_level': 'DEBUG'
}