[Zope3-checkins] SVN: Zope3/branches/ZopeX3-3.0/src/zope/server/ Merged changes from trunk revision 26676

Dmitry Vasiliev dima at hlabs.spb.ru
Thu Jul 22 07:02:21 EDT 2004


Log message for revision 26677:
  Merged changes from trunk revision 26676
  


Changed:
  U   Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/logger.py
  U   Zope3/branches/ZopeX3-3.0/src/zope/server/http/commonaccesslogger.py


-=-
Modified: Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/logger.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/logger.py	2004-07-22 10:53:32 UTC (rev 26676)
+++ Zope3/branches/ZopeX3-3.0/src/zope/server/ftp/logger.py	2004-07-22 11:02:21 UTC (rev 26677)
@@ -17,38 +17,19 @@
 """
 
 import time
-import sys
 
-from zope.server.logger.filelogger import FileLogger
-from zope.server.logger.resolvinglogger import ResolvingLogger
-from zope.server.logger.unresolvinglogger import UnresolvingLogger
+from zope.server.http.commonaccesslogger import CommonAccessLogger
 
-class CommonFTPActivityLogger:
-    """Outputs hits in common HTTP log format.
-    """
+class CommonFTPActivityLogger(CommonAccessLogger):
+    """Outputs hits in common HTTP log format."""
 
-    def __init__(self, logger_object=None, resolver=None):
-        if logger_object is None:
-            logger_object = FileLogger(sys.stdout)
-
-        if resolver is not None:
-            self.output = ResolvingLogger(resolver, logger_object)
-        else:
-            self.output = UnresolvingLogger(logger_object)
-
-
     def log(self, task):
-        """
-        Receives a completed task and logs it in the
-        common log format.
-        """
-
-        now = time.localtime(time.time())
-
-        message = '%s [%s] "%s %s"' % (task.channel.username,
-                                       time.strftime('%Y/%m/%d %H:%M', now),
+        """Receives a completed task and logs it in the common log format."""
+        now = time.time()
+        message = ' - %s [%s] "%s %s"' % (task.channel.username,
+                                       self.log_date_string(now),
                                        task.m_name[4:].upper(),
                                        task.channel.cwd,
                                        )
 
-        self.output.logRequest('127.0.0.1', message)
+        self.output.logRequest(task.channel.addr[0], message)

Modified: Zope3/branches/ZopeX3-3.0/src/zope/server/http/commonaccesslogger.py
===================================================================
--- Zope3/branches/ZopeX3-3.0/src/zope/server/http/commonaccesslogger.py	2004-07-22 10:53:32 UTC (rev 26676)
+++ Zope3/branches/ZopeX3-3.0/src/zope/server/http/commonaccesslogger.py	2004-07-22 11:02:21 UTC (rev 26677)
@@ -17,7 +17,6 @@
 """
 
 import time
-import sys
 
 from zope.server.http.http_date import monthname
 from zope.server.logger.pythonlogger import PythonLogger
@@ -73,12 +72,8 @@
         return '%d/%s/%02d:%02d:%02d:%02d %s' % (
             D, monthname[M], Y, h, m, s, tz)
 
-
     def log(self, task):
-        """
-        Receives a completed task and logs it in the
-        common log format.
-        """
+        """Receives a completed task and logs it in the common log format."""
         now = time.time()
         request_data = task.request_data
         req_headers = request_data.headers



More information about the Zope3-Checkins mailing list