From e2cc51a0f08fd5b2476d093869b0b3a91b543818 Mon Sep 17 00:00:00 2001 From: spl0k Date: Sat, 23 Mar 2019 16:20:19 +0100 Subject: [PATCH] Fixed issues when the watcher is set to log to /dev/null --- supysonic/watcher.py | 5 ++++- tests/frontend/test_folder.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/supysonic/watcher.py b/supysonic/watcher.py index ab80713..f151784 100644 --- a/supysonic/watcher.py +++ b/supysonic/watcher.py @@ -253,7 +253,10 @@ class SupysonicWatcher(object): def run(self): if self.__config.DAEMON['log_file']: - log_handler = TimedRotatingFileHandler(self.__config.DAEMON['log_file'], when = 'midnight') + if self.__config.DAEMON['log_file'] == '/dev/null': + log_handler = logging.NullHandler() + else: + 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.StreamHandler() diff --git a/tests/frontend/test_folder.py b/tests/frontend/test_folder.py index c42107c..8269d45 100644 --- a/tests/frontend/test_folder.py +++ b/tests/frontend/test_folder.py @@ -83,7 +83,7 @@ class FolderTestCase(FrontendTestBase): with db_session: folder = Folder( name = 'folder', - path = 'tests/assets', + path = 'tests/assets/folder', root = True, )