Use CONFIG.log_file property in logging
import logging
-from os.path import join
from .factory import factory
-from .path import log_dir
def initialize():
@@ -12,7 +10,6 @@ def initialize():
log_level = logging.DEBUG
else:
log_level = logging.INFO
- log_file = join(log_dir, CONFIG["logging"]["filename"])
# messages with info and above are printed to stdout
console_handler = factory.console_logger()
@@ -22,7 +19,7 @@ def initialize():
# file handler can log down to debug messages
mode = "a" if CONFIG["logging"]["append"] else "w"
- file_handler = logging.FileHandler(log_file, mode, "utf-8")
+ file_handler = logging.FileHandler(CONFIG.log_file, mode, "utf-8")
file_handler.setFormatter(
logging.Formatter("%(asctime)-15s %(levelname)s[%(name)s]:%(message)s")
)
