generated from dopt-python/py311
implemented logging including development state differentiation
This commit is contained in:
33
src/wce_crm/logging.py
Normal file
33
src/wce_crm/logging.py
Normal 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)
|
||||
Reference in New Issue
Block a user