Files
NAFKA-crm-gui/src/wce_crm/logging.py
2026-06-17 17:30:52 +02:00

43 lines
1.1 KiB
Python

import logging
from dopt_basics.logging import BASE_LOGGER, LoggingConfig, setup_logging
from wce_crm.constants import Config
enable_stderr: bool = False
enable_file: bool = True
if Config.DEVELOPMENT_STATE:
enable_stderr = True
enable_file = False
if not Config.PATH_LOGGING.exists():
Config.PATH_LOGGING.mkdir()
LOGGING_CFG: LoggingConfig = LoggingConfig(
enable_stderr=enable_stderr,
enable_file=enable_file,
logging_dir=Config.PATH_LOGGING,
log_filename=Config.LOG_FILENAME,
file_max_bytes=10_485_760,
file_backup_count=2,
)
setup_logging(LOGGING_CFG)
logger_base = BASE_LOGGER.getChild("wce_crm")
logger_base.setLevel(logging.DEBUG)
# ** GUI
logger_gui = logger_base.getChild("gui")
logger_gui.setLevel(logging.DEBUG)
logger_search_widget = logger_gui.getChild("search_widget")
logger_search_widget.setLevel(logging.DEBUG)
logger_get_data = logger_gui.getChild("get_data")
logger_get_data.setLevel(logging.DEBUG)
logger_auto_form = logger_gui.getChild("get_data_auto_form")
logger_auto_form.setLevel(logging.DEBUG)
# ** Backend
logger_back = logger_base.getChild("backend")
logger_back.setLevel(logging.DEBUG)