1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-22 20:44:55 +00:00

web/lib/utils.py: add workaround for django

It helps to avoid multiple root loggers.
This commit is contained in:
Hidden Z 2010-11-02 18:34:25 +00:00
parent c0b11b5efe
commit 489f1c9f15

View File

@ -8,6 +8,10 @@ from logging import handlers
def get_logger(filename=None, log_level='debug'):
""" Prepare logger instance for our scripts """
# workaround for django
if hasattr(logging, "web_logger"):
return logging.web_logger
LEVELS = {
'debug': logging.DEBUG,
'info': logging.INFO,
@ -27,6 +31,9 @@ def get_logger(filename=None, log_level='debug'):
handler.setFormatter(formatter)
logger.addHandler(handler)
# workaround for django
logging.web_logger = logger
return logger