[Zodb-checkins] CVS: ZODB3/zLOG - __init__.py:1.16

Fred L. Drake, Jr. fred@zope.com
Fri, 10 Jan 2003 13:31:46 -0500


Update of /cvs-repository/ZODB3/zLOG
In directory cvs.zope.org:/tmp/cvs-serv3970

Modified Files:
	__init__.py 
Log Message:
- remove a false statement in the module docstring
- add a way to control how logging is re-initialized


=== ZODB3/zLOG/__init__.py 1.15 => 1.16 ===
--- ZODB3/zLOG/__init__.py:1.15	Fri Dec  6 12:18:32 2002
+++ ZODB3/zLOG/__init__.py	Fri Jan 10 13:31:41 2003
@@ -68,10 +68,6 @@
                traceback.  If provided, then a summary of the error
                is added to the detail.
 
-The callable object can provide a reinitialize method that may be
-called with no arguments to reopen the log files (if any) as part of a
-log-rotation facility.
-
 There is a default event logging facility that:
 
   - swallows logging information by default,
@@ -105,10 +101,26 @@
 # Flag indicating whether LOG() should call initialize()
 _call_initialize = 1
 
+# Function called to (re-)initialize the logger we're using
+_initializer = initialize_from_environment
+
 def initialize():
     global _call_initialize
     _call_initialize = 0
-    initialize_from_environment()
+    _initializer()
+
+def set_initializer(func):
+    """Set the function used to re-initialize the logs.
+
+    This should be called when initialize_from_environment() is not
+    appropiate.
+
+    This does not ensure that the new function gets called; the caller
+    should do that separately.
+    """
+    global _initializer
+    _initializer = func
+
 
 def LOG(subsystem, severity, summary, detail='', error=None, reraise=None):
     """Log some information