mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-02-20 09:40:36 +08:00
feat: use logging
This commit is contained in:
16
common/log.py
Normal file
16
common/log.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import logging
|
||||
import sys
|
||||
|
||||
|
||||
def _get_logger():
|
||||
log = logging.getLogger('log')
|
||||
log.setLevel(logging.DEBUG)
|
||||
console_handle = logging.StreamHandler(sys.stdout)
|
||||
console_handle.setFormatter(logging.Formatter('[%(levelname)s][%(asctime)s][%(filename)s:%(lineno)d] - %(message)s',
|
||||
datefmt='%Y-%m-%d %H:%M:%S'))
|
||||
log.addHandler(console_handle)
|
||||
return log
|
||||
|
||||
|
||||
# 日志句柄
|
||||
logger = _get_logger()
|
||||
Reference in New Issue
Block a user