本文介绍了Python日志记录:disable()的反作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
记录文档说,调用logging.disable(lvl)
方法可以暂时限制记录输出遍及整个应用程序",但是我很难找到临时".以下面的脚本为例:
The logging docs say that calling the logging.disable(lvl)
method can "temporarily throttle logging output down across the whole application," but I'm having trouble finding the "temporarily." Take, for example, the following script:
import logging
logging.disable(logging.CRITICAL)
logging.warning("test")
# Something here
logging.warning("test")
到目前为止,我还找不到能够重新启用整个日志记录系统并允许第二个warning
通过的Something here
. disable()
是否与之相反?
So far, I haven't been able to find the Something here
that will re-enable the logging system as a whole and allow the second warning
to get through. Is there a reverse to disable()
?
推荐答案
logging.disable(logging.NOTSET)
这篇关于Python日志记录:disable()的反作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!