Add a DebugFilter class to weboob/tools/log.py
The browser2 filter debugging is an extra level of "Debug". Since python logging does not support adding severity levels, we use the Filter class to remove the lines by default. Sadly, we cannot pass variable to filters (logging system does not use the instance passed with addFilter method), so we use to write a filter for each use case (today: only one...)
This commit is contained in:
parent
d014312a3d
commit
1b0096e6e3
1 changed files with 11 additions and 1 deletions
|
|
@ -18,7 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from collections import defaultdict
|
||||
from logging import Formatter, getLogger as _getLogger
|
||||
from logging import Filter, Formatter, getLogger as _getLogger
|
||||
import sys
|
||||
|
||||
|
||||
|
|
@ -49,6 +49,16 @@ def getLogger(name, parent=None):
|
|||
return logger
|
||||
|
||||
|
||||
class DebugFilter(Filter):
|
||||
"""
|
||||
Allow a fine filtering of debug output
|
||||
"""
|
||||
def filter(self, record):
|
||||
if record.name == "b2filters":
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class ColoredFormatter(Formatter):
|
||||
"""
|
||||
Class written by airmind:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue