From a2238de163ca692a3b0e81bed2680ad578a4e147 Mon Sep 17 00:00:00 2001 From: Fred Drake <fdrake@acm.org> Date: Fri, 10 Jan 2003 18:31:41 +0000 Subject: [PATCH] - remove a false statement in the module docstring - add a way to control how logging is re-initialized --- src/zLOG/__init__.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/zLOG/__init__.py b/src/zLOG/__init__.py index c9d6a658..730d7d1e 100644 --- a/src/zLOG/__init__.py +++ b/src/zLOG/__init__.py @@ -68,10 +68,6 @@ with a callable object that takes 5 arguments: 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, @@ -86,7 +82,7 @@ There is a default event logging facility that: can be overridden with the environment variable EVENT_LOG_SEVERITY """ -__version__='$Revision: 1.15 $'[11:-2] +__version__='$Revision: 1.16 $'[11:-2] from EventLogger import log_write, log_time, severity_string, \ initialize_from_environment @@ -105,10 +101,26 @@ PANIC = 300 # 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 -- 2.30.9