[Zope3-checkins] CVS: Zope/lib/python/ZConfig/components/logger -
logger.py:1.4
Fred L. Drake, Jr.
fred at zope.com
Tue Apr 13 13:02:54 EDT 2004
Update of /cvs-repository/Zope/lib/python/ZConfig/components/logger
In directory cvs.zope.org:/tmp/cvs-serv9927
Modified Files:
logger.py
Log Message:
add a reopen() method to the factory to allow FileHandlers to be
reopened when rotating logs
=== Zope/lib/python/ZConfig/components/logger/logger.py 1.3 => 1.4 ===
--- Zope/lib/python/ZConfig/components/logger/logger.py:1.3 Tue Apr 13 10:08:44 2004
+++ Zope/lib/python/ZConfig/components/logger/logger.py Tue Apr 13 13:02:53 2004
@@ -60,6 +60,20 @@
lowest = factory.getLevel()
return lowest
+ def reopen(self):
+ """Re-open any handlers for which this is a meaningful operation.
+
+ This only works on handlers on the logger provided by this
+ factory directly; handlers for child loggers are not affected.
+ (This can be considered a bug, but is sufficient at the
+ moment.)
+ """
+ logger = self()
+ for handler in logger.handlers:
+ reopen = getattr(handler, "reopen", None)
+ if reopen is not None and callable(reopen):
+ reopen()
+
class EventLogFactory(LoggerFactoryBase):
"""Logger factory that returns the root logger."""
More information about the Zope3-Checkins
mailing list