[issue8162] logging.disable() incoherency
report at bugs.python.org
Wed Mar 17 11:06:36 CET 2010
New submission from Pascal Chambon <chambon.pascal at gmail.com>:
I see some trouble in the semantic of logging.disable(lvl) :
according to the doc (and docstrings), it's the same as a logger.setLevel(lvl) called on all logger, but in reality it doesn't act the same way : when we call logger.setLevel(lvl), log messages at level lvl WILL be logged, whereas with logger.disable(lvl), they will NOT be logged (CF method below from logging/__init__.py).
So maybe the best would be to explain that disable() also disable the target level itself, and to set by default this disabling level to -1 (and not 0 as currently), so that by default ALL messages get loged, even those set to level 0.
def isEnabledFor(self, level):
Is this logger enabled for level 'level'?
if self.manager.disable >= level:
return level >= self.getEffectiveLevel()
components: Documentation, Library (Lib)
nosy: georg.brandl, pakal
title: logging.disable() incoherency
versions: Python 2.6, Python 2.7
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list