From a69f4294bc3ab27c4a54d6512962a41f26d4df7b Mon Sep 17 00:00:00 2001 From: derwinlu Date: Mon, 19 Oct 2015 16:22:43 +0200 Subject: [PATCH] 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. --- pelican/log.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pelican/log.py b/pelican/log.py index 0f4b795b..12eb7371 100644 --- a/pelican/log.py +++ b/pelican/log.py @@ -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)