日志打印
简单配置如下:
import logging
import sys
sys.stdout.reconfigure(encoding='utf-8')
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)-5.5s]:%(message)s",
handlers=[
logging.FileHandler("all.log", 'w', 'utf-8'),
logging.StreamHandler(sys.stdout)
]
)
logging.info('hello world')
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
编辑此页 (opens new window)
更新于: 2019-06-11 10:55