[Zope-Checkins] CVS: Zope/lib/python/ZConfig/components/logger -
logger.py:1.6
Fred L. Drake, Jr.
fred at zope.com
Thu Apr 22 15:55:57 EDT 2004
Update of /cvs-repository/Zope/lib/python/ZConfig/components/logger
In directory cvs.zope.org:/tmp/cvs-serv23525
Modified Files:
logger.py
Log Message:
getLowestHandlerLevel() didn't treat level == NOTSET properly; this
now avoids comparing a logging level with NOTSET, but still returns
NOTSET if none of the levels for the loggers or handlers were set
=== Zope/lib/python/ZConfig/components/logger/logger.py 1.5 => 1.6 ===
--- Zope/lib/python/ZConfig/components/logger/logger.py:1.5 Thu Apr 22 15:26:12 2004
+++ Zope/lib/python/ZConfig/components/logger/logger.py Thu Apr 22 15:55:56 2004
@@ -51,12 +51,20 @@
self()
def getLowestHandlerLevel(self):
- """Return the lowest log level provided by any configured handler."""
+ """Return the lowest log level provided by any configured handler.
+
+ If all handlers and the logger itself have level==NOTSET, this
+ returns NOTSET.
+ """
+ import logging
lowest = self.level
for factory in self.handler_factories:
- handler_level = factory.getLevel()
- if handler_level < lowest:
- lowest = factory.getLevel()
+ level = factory.getLevel()
+ if level != logging.NOTSET:
+ if lowest == logging.NOTSET:
+ lowest = level
+ else:
+ lowest = min(lowest, level)
return lowest
def reopen(self):
More information about the Zope-Checkins
mailing list