[Zope-Checkins] CVS: Zope/lib/python/ZServer - BaseLogger.py:1.1
AccessLogger.py:1.3 DebugLogger.py:1.11
Fred L. Drake, Jr.
fred at zope.com
Tue Apr 13 11:11:36 EDT 2004
Update of /cvs-repository/Zope/lib/python/ZServer
In directory cvs.zope.org:/tmp/cvs-serv22359
Modified Files:
AccessLogger.py DebugLogger.py
Added Files:
BaseLogger.py
Log Message:
add BaseLogger to ZServer, since this is now the only place it is used
=== Added File Zope/lib/python/ZServer/BaseLogger.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# 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
#
##############################################################################
"""
An abstract logger meant to provide features to the access logger,
the event logger, and the debug logger.
"""
import logging
class BaseLogger:
def __init__(self, name):
self.logger = logging.getLogger(name)
self.logger.propagate = False
def reopen(self):
for handler in self.logger.handlers:
if hasattr(handler, 'reopen') and callable(handler.reopen):
handler.reopen()
=== Zope/lib/python/ZServer/AccessLogger.py 1.2 => 1.3 ===
--- Zope/lib/python/ZServer/AccessLogger.py:1.2 Tue Mar 18 16:15:14 2003
+++ Zope/lib/python/ZServer/AccessLogger.py Tue Apr 13 11:11:35 2004
@@ -16,13 +16,17 @@
This depends on Vinay Sajip's PEP 282 logging module.
"""
-import logging
-from zLOG.BaseLogger import BaseLogger
+
+from ZServer.BaseLogger import BaseLogger
+
class AccessLogger(BaseLogger):
- logger = logging.getLogger('access')
+
+ def __init__(self):
+ BaseLogger.__init__(self, 'access')
+
def log(self, message):
- if not self.logger.handlers: # dont log if we have no handlers
+ if not self.logger.handlers: # don't log if we have no handlers
return
if message.endswith('\n'):
message = message[:-1]
=== Zope/lib/python/ZServer/DebugLogger.py 1.10 => 1.11 ===
--- Zope/lib/python/ZServer/DebugLogger.py:1.10 Tue Mar 18 16:15:14 2003
+++ Zope/lib/python/ZServer/DebugLogger.py Tue Apr 13 11:11:35 2004
@@ -36,12 +36,13 @@
import time
import logging
-from zLOG.BaseLogger import BaseLogger
+from ZServer.BaseLogger import BaseLogger
class DebugLogger(BaseLogger):
- logger = logging.getLogger('trace')
+ def __init__(self):
+ BaseLogger.__init__(self, 'trace')
def log(self, code, request_id, data=''):
if not self.logger.handlers:
More information about the Zope-Checkins
mailing list