import http.client
import logging
import requests
LOG_LEVEL = logging.DEBUG
LOG_FORMAT = '%(asctime)s [%(thread)s] [%(name)s:%(funcName)s#%(lineno)d] %(levelname)s %(message)s'
logging.basicConfig(level=LOG_LEVEL, format=LOG_FORMAT)
LOG_HTTP = logging.getLogger("http.client")
def httpclient_log(*args):
LOG_HTTP.log(logging.DEBUG, " ".join(args))
http.client.print = httpclient_log
http.client.HTTPConnection.debuglevel = 1
TOC
Requests 的日志配置
发布于码厩技术博客的所有文章,除注明转载外,均为作者原创,欢迎转载,但必须注明出处。
尊重他人劳动,共创开源社区!转载请注明以下信息:
转载来源: 码厩技术博客 [https://www.markjour.com]
原文标题:Requests 的日志配置
原文地址:/article/20190809-requests-logging.html
尊重他人劳动,共创开源社区!转载请注明以下信息:
转载来源: 码厩技术博客 [https://www.markjour.com]
原文标题:Requests 的日志配置
原文地址:/article/20190809-requests-logging.html

如果你有魔法,你可以看到一个评论框~