diff --git a/__init__.py b/__init__.py index 6c92af7..2a494f2 100644 --- a/__init__.py +++ b/__init__.py @@ -204,6 +204,12 @@ def add_handler_socket(logger: logging.Logger, level: int = logging.DEBUG, host: 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): """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) add_handler_stdout(logger, config.LOG_LEVEL, fmt=fmt) - if config.DEBUG: - add_handler_socket(logger, host=config.LOG_HOSTNAME) - return logger + return app_logging_config() class testSession(dict):