标签:cal png formatter you error 比较 The critical ogg
logging模块功能比较多,但一般情况下使用其简单功能就已经足够了。
最简单的用法如下:
import logging
logging.baiscConfig(level=logging.DEBUG)
logging.debug(‘message‘)
logging.critical(‘message‘)
logging.warning(‘%s before you %s‘, ‘Look‘, ‘leap!‘)
logging.warning(‘{} before you {}‘.format(‘Look‘, ‘leap!‘))
如果对日志格式、输出、日期格式等有要求,可以增加basicConfig的关键字参数,如:
logging.basicConfig(filename=‘example.log‘,level=logging.DEBUG)
对于basicConfig方法所有的关键字参数如下:
logging.
basicConfig
(**kwargs)
Does basic configuration for the logging system by creating a StreamHandler
with a default Formatter
and adding it to the root logger. The functions debug()
, info()
, warning()
, error()
and critical()
will call basicConfig()
automatically if no handlers are defined for the root logger.
标签:cal png formatter you error 比较 The critical ogg
原文地址:https://www.cnblogs.com/dingbj/p/logging.html