nonebot2/nonebot/log.py

16 lines
376 B
Python
Raw Normal View History

2018-07-21 00:46:34 +08:00
"""
Provide logger object.
2018-12-27 20:23:45 +08:00
Any other modules in "nonebot" should use "logger" from this module
2018-07-21 00:46:34 +08:00
to log messages.
"""
2018-06-27 22:05:12 +08:00
import logging
2018-07-02 16:54:29 +08:00
import sys
2018-06-27 22:05:12 +08:00
2018-12-27 20:23:45 +08:00
logger = logging.getLogger('nonebot')
2018-06-27 22:05:12 +08:00
default_handler = logging.StreamHandler(sys.stdout)
2020-04-20 13:50:38 +08:00
default_handler.setFormatter(
logging.Formatter('[%(asctime)s %(name)s] %(levelname)s: %(message)s'))
2018-06-27 22:05:12 +08:00
logger.addHandler(default_handler)