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

@ -206,7 +206,7 @@ class StandardBrowser(mechanize.Browser):
# display messages from httplib
self.set_debug_http(True)
if logging.root.level == logging.DEBUG:
if logging.root.level <= logging.DEBUG:
# Enable log messages from mechanize.Browser
self.set_debug_redirects(True)
mech_logger = logging.getLogger("mechanize")