在Twisted中是否有任何方法可以更改应记录的消息的日志记录级别?
我在项目中使用三个级别:
log.msg('agent nr.1 has free slots', logging.DEBUG) # debug message
log.msg('agent nr.1 has free slots') # info message
log.err('agent nr.1 has free slots') # error message
Run Code Online (Sandbox Code Playgroud)
我以这种方式配置日志记录:
from twisted.python import log
from twisted.python.logfile import LogFile
logfile = LogFile("someFile.log", '/some/path/', rotateLength=1000, maxRotatedFiles=100)
application.setComponent(log.ILogObserver, log.FileLogObserver(logfile).emit)
Run Code Online (Sandbox Code Playgroud)
但是我需要设置应该记录哪些消息(例如,只有信息和错误消息,没有调试).怎么做?