Add ability to toggle log filter

To test the output of warning functions it can be useful to disable the
log filter, producing the expected output instead of the limited output
that is used during normal operation.
This commit is contained in:
derwinlu 2015-10-19 16:22:43 +02:00
commit a69f4294bc

View file

@ -167,6 +167,12 @@ class LimitLogger(SafeLogger):
def __init__(self, *args, **kwargs):
super(LimitLogger, self).__init__(*args, **kwargs)
self.enable_filter()
def disable_filter(self):
self.removeFilter(LimitLogger.limit_filter)
def enable_filter(self):
self.addFilter(LimitLogger.limit_filter)
logging.setLoggerClass(LimitLogger)