From 5995368f07f7f680136860af55510dbb61e7503b Mon Sep 17 00:00:00 2001 From: Dirk Alders Date: Mon, 4 Aug 2025 08:34:08 +0200 Subject: [PATCH] app and default logging joined except of fmt --- __init__.py | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/__init__.py b/__init__.py index a4ed872..fce7ebb 100644 --- a/__init__.py +++ b/__init__.py @@ -43,7 +43,7 @@ except ImportError: try: from config import LOG_LEVEL except ImportError: - LOG_LEVEL = logging.DEBUG + LOG_LEVEL = logging.WARNING try: from config import LOG_HOSTNAME except ImportError: @@ -215,22 +215,6 @@ def add_handler_socket(logger: logging.Logger, level: int = logging.DEBUG, host: return handler -def app_logging_config(): - """You are able to configure logging by a config file including these line: - - DEBUG = False - # - # Logging - # - APP_NAME = "" - LOG_HOSTNAME = "loggy" # When DEBUG is True - """ - logger = logging.getLogger(ROOT_LOGGER_NAME) - if DEBUG: - add_handler_socket(logger, host=LOG_HOSTNAME) - return logger.getChild('main') - - def default_logging_config(fmt=JOURNAL_FMT): """You are able to configure logging by a config file including these line: @@ -248,7 +232,16 @@ def default_logging_config(fmt=JOURNAL_FMT): logger = logging.getLogger(ROOT_LOGGER_NAME) add_handler_stdout(logger, LOG_LEVEL, fmt=fmt) - return app_logging_config() + if DEBUG: + add_handler_socket(logger, host=LOG_HOSTNAME) + return logger.getChild('main') + + +def app_logging_config(): + """ + For details see comment in default_logging_config. + """ + return default_logging_config(LONG_FMT) class testSession(dict):