mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-22 17:06:17 +00:00
watcher: log to stderr when no logfile is set
This commit is contained in:
parent
f5bab00a1c
commit
b195aca12f
@ -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)
|
||||
|
@ -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'
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user