[Zodb-checkins] CVS: StandaloneZODB/zLOG - MinimalLogger.py:1.10
Jeremy Hylton
jeremy@zope.com
Mon, 5 Aug 2002 17:46:51 -0400
Update of /cvs-repository/StandaloneZODB/zLOG
In directory cvs.zope.org:/tmp/cvs-serv22002/zLOG
Modified Files:
MinimalLogger.py
Log Message:
Expose initialize() and rotate(0 methods of _log.
Also, reformat doc strings, remove an unused global variable, and
remove one whitespace character. (I've already used the whitespace
in a different module.)
=== StandaloneZODB/zLOG/MinimalLogger.py 1.9 => 1.10 ===
##############################################################################
__version__='$Revision$'[11:-2]
-import os, sys, time
+import os, sys, time
from FormatException import format_exception
@@ -26,16 +26,12 @@
200: 'ERROR',
300: 'PANIC',
}):
- """Convert a severity code to a string
- """
- s=int(severity)
- if mapping.has_key(s): s=mapping[s]
- else: s=''
+ """Convert a severity code to a string."""
+ s = mapping.get(int(severity), '')
return "%s(%s)" % (s, severity)
def log_time():
- """Return a simple time string without spaces suitable for logging
- """
+ """Return a simple time string without spaces suitable for logging."""
return ("%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d"
% time.localtime()[:6])
@@ -45,7 +41,6 @@
_log_dest = None
_stupid_severity = None
-_no_stupid_log = []
class stupid_log_write:
@@ -58,7 +53,9 @@
# EVENT_LOG_FILE is the preferred envvar, but we accept
# STUPID_LOG_FILE also
- path = eget('EVENT_LOG_FILE') or eget('STUPID_LOG_FILE')
+ path = eget('EVENT_LOG_FILE')
+ if path is None:
+ path = eget('STUPID_LOG_FILE')
if path is None:
_log_dest = None
else:
@@ -101,3 +98,5 @@
_log = stupid_log_write()
log_write = _log.log
+initialize = _log.initialize
+rotate = _log.rotate