[Zope-Checkins] CVS: Zope/lib/python/zLOG - datatypes.py:1.11

Chris McDonough chrism@zope.com
Sat, 2 Aug 2003 01:45:56 -0400


Update of /cvs-repository/Zope/lib/python/zLOG
In directory cvs.zope.org:/tmp/cvs-serv16419/lib/python/zLOG

Modified Files:
	datatypes.py 
Log Message:
Refactor start_zope function and add tests for its functionality.

Changes:

 - startup log handler now pays attention to the logging levels of
   the handlers defined within the config file and uses the "lowest"
   level to log messages to stdout during startup.

 - entirely removed warning when the starting user's umask is "too
   permissive".  it wasn't clear that it added any value under normal
   operations.

 - replaced ancient setuid code with code stolen from zdaemon that
   works the same but looks nicer.



=== Zope/lib/python/zLOG/datatypes.py 1.10 => 1.11 ===
--- Zope/lib/python/zLOG/datatypes.py:1.10	Thu Jan 23 16:38:03 2003
+++ Zope/lib/python/zLOG/datatypes.py	Sat Aug  2 01:45:51 2003
@@ -97,6 +97,9 @@
         logger.setLevel(self.section.level)
         return logger
 
+    def getLevel(self):
+        return self.section.level
+
 class FileHandlerFactory(HandlerFactory):
     def create_loghandler(self):
         from zLOG.LogHandlers import StreamHandler, FileHandler
@@ -224,3 +227,14 @@
             from zLOG.LogHandlers import NullHandler
             logger.addHandler(NullHandler())
         return logger
+
+    def getLowestHandlerLevel(self):
+        """ Return the lowest log level provided by any of our handlers
+        (used by Zope startup logger code to decide what to send
+        to stderr during startup) """
+        lowest = self.level
+        for factory in self.handler_factories:
+            handler_level = factory.getLevel()
+            if handler_level < lowest:
+                lowest = factory.getLevel()
+        return lowest