在调试的过程中,很多地方需要用到日志

  • 如下
import logging
LOG_FORMAT = "%(asctime)s - %(levelname)s - %(message)s"
logging.basicConfig(filename='my.log', level=logging.DEBUG, format=LOG_FORMAT)

logging.debug("log")

日志还是很多种级别,这里就记录debug级别

Read The Fucking Source Code