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