Move logger instance construction to factory
MODIFY
plextraktsync/factory.py
plextraktsync/factory.py
@@ -116,7 +116,13 @@ def walker(self):
@cached_property
def logger(self):
- from plextraktsync.logging import logger
+ import logging
+
+ from plextraktsync.logging import initialize
+
+ config = self.config()
+ initialize(config)
+ logger = logging.getLogger("PlexTraktSync")
return logger

MODIFY
plextraktsync/logging.py
plextraktsync/logging.py
from .factory import factory
-def initialize():
- config = factory.config()
+def initialize(config):
# global log level for all messages
log_level = logging.DEBUG if config.log_debug else logging.INFO
@@ -35,7 +34,3 @@ def initialize():
logger.removeHandler(loghandler)
logger.setLevel(logging.DEBUG)
-
-
-initialize()
-logger = logging.getLogger("PlexTraktSync")

Move logger instance construction to factory