implemented logging including development state differentiation

This commit is contained in:
2026-05-28 09:23:15 +02:00
parent 3c8171fa79
commit f87d7cc713
3 changed files with 44 additions and 15 deletions

33
src/wce_crm/logging.py Normal file
View File

@@ -0,0 +1,33 @@
import logging
from dopt_basics.logging import BASE_LOGGER, 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()
setup_logging(
enable_stderr=enable_stderr,
enable_file=enable_file,
logging_dir=Config.PATH_LOGGING,
log_filename=Config.LOG_FILENAME,
)
logger_base = BASE_LOGGER.getChild("wce_crm")
# ** 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)