|
|
|
|
|
|
import logging # noqa I251 |
|
|
|
import sys |
|
|
|
|
|
|
|
CRITICAL = logging.CRITICAL |
|
|
|
FATAL = logging.FATAL |
|
|
|
|
|
|
specified by set_log_level() |
|
|
|
""" |
|
|
|
logger = logging.getLogger(name=name) |
|
|
|
|
|
|
|
|
|
|
|
handler = logging.StreamHandler(stream=sys.stdout) |
|
|
|
formatter = logging.Formatter(fmt=LOG_FORMAT, datefmt=DATE_FORMAT) |
|
|
|
handler.setFormatter(formatter) |
|
|
|
logger.addHandler(handler) |
|
|
|
|
|
|
|
# Keep track of this logger so that we can change the log level later |
|
|
|
_loggers.add(logger) |
|
|
|
|
|
|
""" |
|
|
|
global _log_level |
|
|
|
_log_level = log_level |
|
|
|
|
|
|
|
# Configure the log format. |
|
|
|
# In theory, this would be sufficient, but if another library calls logging.basicConfig |
|
|
|
# first, it doesn't have any effect. |
|
|
|
logging.basicConfig(level=_log_level, format=LOG_FORMAT, datefmt=DATE_FORMAT) |
|
|
|
|
|
|
|
for logger in _loggers: |
|
|
|
logger.setLevel(log_level) |