2020-01-09 14:48:17 +00:00
|
|
|
import logging
|
|
|
|
|
|
|
|
|
|
|
|
def get_logger(name='root'):
|
|
|
|
formatter = logging.Formatter(
|
|
|
|
# fmt='%(asctime)s [%(levelname)s]: %(filename)s(%(funcName)s:%(lineno)s) >> %(message)s')
|
|
|
|
fmt='%(asctime)s [%(levelname)s]: %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
|
|
|
|
|
|
|
|
handler = logging.StreamHandler()
|
|
|
|
handler.setFormatter(formatter)
|
|
|
|
|
|
|
|
logger = logging.getLogger(name)
|
2023-04-05 15:17:35 +00:00
|
|
|
logger.setLevel(logging.INFO)
|
2020-01-09 14:48:17 +00:00
|
|
|
logger.addHandler(handler)
|
|
|
|
return logger
|
|
|
|
|
|
|
|
|
|
|
|
logger = get_logger('root')
|