[Zope3-checkins] CVS: Zope3/src/zope/app/process - loghandlers.py:1.1.2.2
Fred L. Drake, Jr.
fred@zope.com
Tue, 24 Jun 2003 15:08:57 -0400
Update of /cvs-repository/Zope3/src/zope/app/process
In directory cvs.zope.org:/tmp/cvs-serv25172
Modified Files:
Tag: fdrake-zconfig-in-zope-3-branch
loghandlers.py
Log Message:
- update docstring style
- normalize whitespace
=== Zope3/src/zope/app/process/loghandlers.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/process/loghandlers.py:1.1.2.1 Mon Jun 23 18:07:58 2003
+++ Zope3/src/zope/app/process/loghandlers.py Tue Jun 24 15:08:57 2003
@@ -7,9 +7,10 @@
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE.
#
##############################################################################
+
"""Handlers which can plug into a PEP 282 logger."""
import sys
@@ -19,11 +20,10 @@
from logging.handlers import HTTPHandler, SMTPHandler
from logging.handlers import NTEventLogHandler as Win32EventLogHandler
+
class FileHandler(StreamHandler):
- """
- A file handler which allows for reopening of logs in favor of the
- 'rollover' features of the standard PEP282 FileHandler.
- """
+ """File handler supporting the traditional way of reopening logs."""
+
def __init__(self, filename, mode="a"):
StreamHandler.__init__(self, open(filename, mode))
self.baseFilename = filename
@@ -36,21 +36,23 @@
self.close()
self.stream = open(self.baseFilename, self.mode)
+
class NullHandler(Handler):
- """
- A null handler. Does nothing.
- """
+ """A null handler. Does nothing."""
+
def emit(self, record):
pass
def handle(self, record):
pass
+
class StartupHandler(Handler):
- """
- A handler which outputs messages to a stream but also buffers them until
- they can be flushed to a target handler. Useful at startup before we can
- know that we can safely write to a config-specified handler.
+ """Handler which dumps messages to a stream and buffers them.
+
+ The intention is that the messages eventually will be flushed to
+ another handler. This is useful at startup before we can know
+ that we can safely write to a configuration-specified handler.
"""
def __init__(self, stream=None):
Handler.__init__(self)
@@ -75,8 +77,3 @@
for record in self.buffer:
target.handle(record)
self.buffer = []
-
-
-
-
-