[Zope-Checkins] CVS: ZODB3/zLOG - datatypes.py:1.2
Fred L. Drake, Jr.
fred@zope.com
Mon, 13 Jan 2003 11:17:14 -0500
Update of /cvs-repository/ZODB3/zLOG
In directory cvs.zope.org:/tmp/cvs-serv27585/zLOG
Modified Files:
datatypes.py
Log Message:
Make sure the datatype for the "logger" section type adds a NullHandler if
no other handlers are provided. This is needed to avoid warnings on stderr
from the logging package.
=== ZODB3/zLOG/datatypes.py 1.1 => 1.2 ===
--- ZODB3/zLOG/datatypes.py:1.1 Fri Jan 10 13:33:08 2003
+++ ZODB3/zLOG/datatypes.py Mon Jan 13 11:16:42 2003
@@ -235,8 +235,12 @@
logger.handlers = []
logger.propagate = 0
logger.setLevel(self.level)
- for handler_factory in self.handler_factories:
- handler = handler_factory()
- logger.addHandler(handler)
+ if self.handler_factories:
+ for handler_factory in self.handler_factories:
+ handler = handler_factory()
+ logger.addHandler(handler)
+ else:
+ from zLOG.LogHandlers import NullHandler
+ logger.addHandler(NullHandler())
self.resolved = logger
return self.resolved