mirror of
https://github.com/spl0k/supysonic.git
synced 2024-11-09 19:52:16 +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):
|
def run(self):
|
||||||
if self.__config.DAEMON['log_file']:
|
if self.__config.DAEMON['log_file']:
|
||||||
log_handler = TimedRotatingFileHandler(self.__config.DAEMON['log_file'], when = 'midnight')
|
log_handler = TimedRotatingFileHandler(self.__config.DAEMON['log_file'], when = 'midnight')
|
||||||
|
log_handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(message)s"))
|
||||||
else:
|
else:
|
||||||
log_handler = logging.NullHandler()
|
log_handler = logging.StreamHandler()
|
||||||
log_handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(message)s"))
|
log_handler.setFormatter(logging.Formatter("[%(levelname)s] %(message)s"))
|
||||||
logger.addHandler(log_handler)
|
logger.addHandler(log_handler)
|
||||||
if 'log_level' in self.__config.DAEMON:
|
if 'log_level' in self.__config.DAEMON:
|
||||||
level = getattr(logging, self.__config.DAEMON['log_level'].upper(), logging.NOTSET)
|
level = getattr(logging, self.__config.DAEMON['log_level'].upper(), logging.NOTSET)
|
||||||
|
@ -30,7 +30,7 @@ from ..testbase import TestConfig
|
|||||||
class WatcherTestConfig(TestConfig):
|
class WatcherTestConfig(TestConfig):
|
||||||
DAEMON = {
|
DAEMON = {
|
||||||
'wait_delay': 0.5,
|
'wait_delay': 0.5,
|
||||||
'log_file': None,
|
'log_file': '/dev/null',
|
||||||
'log_level': 'DEBUG'
|
'log_level': 'DEBUG'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user