Split to default and app logger config
This commit is contained in:
parent
60be78310e
commit
21de229d67
10
__init__.py
10
__init__.py
@ -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):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user