Fix1 for default logging config

This commit is contained in:
Dirk Alders 2025-07-27 13:00:06 +02:00
parent 9d3b133246
commit 9ad0dd05a5

View File

@ -49,6 +49,8 @@ For more Information read the sphinx documentation.""" % __name__.replace('_', '
__INTERPRETER__ = (3, )
"""The Tested Interpreter-Versions"""
JOURNAL_FMT = "%(levelname)8s - %(name)s - %(message)s"
""" A short journal formatter including the most important information"""
SHORT_FMT = "%(asctime)s: %(levelname)8s - %(name)s - %(message)s"
""" A short formatter including the most important information"""
LONG_FMT = SHORT_FMT + "\n File \"%(pathname)s\", line %(lineno)d, in %(funcName)s"
@ -201,13 +203,13 @@ def add_handler_socket(logger: logging.Logger, level: int = logging.DEBUG, host:
logger.addHandler(handler)
return handler
def default_logging_config():
def default_logging_config(fmt=JOURNAL_FMT):
logger = logging.getLogger(ROOT_LOGGER_NAME)
add_handler_stdout(logger, config.LOG_LEVEL)
add_handler_stdout(logger, config.LOG_LEVEL, fmt=fmt)
if config.DEBUG:
add_handler_socket(logger, host=config.LOG_HOSTNAME)
return loggger
return logger
def appLoggingConfigure(basepath, target, log_name_lvl=[], target_level=logging.DEBUG, fmt=SHORT_FMT, ring_logs=None, host=None, port=None):