lipeng 发表于 2017-4-26 08:28:19

python logging usage

when you use some third part library,you want to print out these libraries debug info may help you dailogous,code as follows:

import logging
from urllib3.connectionpool import log
console = logging.StreamHandler()

console.setLevel(logging.INFO)

formatter = logging.Formatter("%(asctime)s %(levelname)s %(message)s")

console.setFormatter(formatter)

log.addHandler(console)

reference:http://blog.sina.com.cn/s/blog_51294ca50100gc3x.html

http://img.zemanta.com/pixy.gif?x-id=1d4d1599-eb5d-8c0d-85ef-417329b0a165
页: [1]
查看完整版本: python logging usage