logging: Create a new level DEBUG_FILTERS

This is a cleaner approach that requires less configuration
in other applications.
This also easily allows us to have another color.

Many checks were made on being exactly at the DEBUG level, they were
fixed to also check on being below DEBUG (i.e. DEBUG_FILTERS).
This commit is contained in:
Laurent Bachelier 2014-10-07 17:07:48 +02:00
commit 7be9a6468b
12 changed files with 27 additions and 35 deletions

View file

@ -21,7 +21,7 @@ import re
import sys
from copy import deepcopy
from weboob.tools.log import getLogger
from weboob.tools.log import getLogger, DEBUG_FILTERS
from weboob.tools.ordereddict import OrderedDict
from weboob.browser.pages import NextPage
@ -270,7 +270,7 @@ class ItemElement(AbstractElement):
self.logger.warning('Attribute %s raises %s' % (key, repr(e)))
raise
logger = getLogger('b2filters')
logger.debug("%s.%s = %r" % (self._random_id, key, value))
logger.log(DEBUG_FILTERS, "%s.%s = %r" % (self._random_id, key, value))
setattr(self.obj, key, value)