New submission from Pascal Chambon <[email protected]>:
Hello
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 0
return level >= self.getEffectiveLevel()
----------
assignee: georg.brandl
components: Documentation, Library (Lib)
messages: 101215
nosy: georg.brandl, pakal
severity: normal
status: open
title: logging.disable() incoherency
type: behavior
versions: Python 2.6, Python 2.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue8162>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com