Split to default and app logger config

This commit is contained in:
Dirk Alders 2025-07-27 14:49:55 +02:00
parent 60be78310e
commit 21de229d67

View File

@ -204,6 +204,12 @@ def add_handler_socket(logger: logging.Logger, level: int = logging.DEBUG, host:
return handler return handler
def app_logging_config():
if config.DEBUG:
add_handler_socket(logger, host=config.LOG_HOSTNAME)
return logger.getChild('main')
def default_logging_config(fmt=JOURNAL_FMT): def default_logging_config(fmt=JOURNAL_FMT):
"""This requires a config file with at least these line: """This requires a config file with at least these line:
@ -221,9 +227,7 @@ def default_logging_config(fmt=JOURNAL_FMT):
logger = logging.getLogger(ROOT_LOGGER_NAME) logger = logging.getLogger(ROOT_LOGGER_NAME)
add_handler_stdout(logger, config.LOG_LEVEL, fmt=fmt) add_handler_stdout(logger, config.LOG_LEVEL, fmt=fmt)
if config.DEBUG: return app_logging_config()
add_handler_socket(logger, host=config.LOG_HOSTNAME)
return logger
class testSession(dict): class testSession(dict):