[Zope-Checkins] CVS: Zope/ZServer - FCGIServer.py:1.14
Andreas Jung
andreas@digicool.com
Thu, 11 Apr 2002 13:34:30 -0400
Update of /cvs-repository/Zope/ZServer
In directory cvs.zope.org:/tmp/cvs-serv32068/ZServer
Modified Files:
FCGIServer.py
Log Message:
Collector #341: minor fixes to logging code
=== Zope/ZServer/FCGIServer.py 1.13 => 1.14 ===
DebugLogger.log('E', id(self))
+
+ user_agent=self.get_header('user-agent')
+ if not user_agent: user_agent=''
+ referer=self.get_header('referer')
+ if not referer: referer=''
+
+ auth=self.get_header('Authorization')
+ name='Anonymous'
+ if auth is not None:
+ if string.lower(auth[:6]) == 'basic ':
+ try: decoded=base64.decodestring(auth[6:])
+ except base64.binascii.Error: decoded=''
+ t = string.split(decoded, ':', 1)
+ if len(t) < 2:
+ name = 'Unknown (bad auth string)'
+ else:
+ name = t[0]
if self.env.has_key('PATH_INFO'):
path=self.env['PATH_INFO']
@@ -452,20 +469,22 @@
self.addr[1],
time.strftime (
'%d/%b/%Y:%H:%M:%S ',
- time.gmtime(time.time())
+ time.localtime(time.time())
) + tz_for_log,
- method, path, self.reply_code, bytes
+ method, path, self.reply_code, bytes,
+ referer, user_agent
)
)
else:
self.server.logger.log (
- '127.0.0.1',
+ '127.0.0.1 ',
'- - [%s] "%s %s" %d %d' % (
time.strftime (
'%d/%b/%Y:%H:%M:%S ',
- time.gmtime(time.time())
+ time.localtime(time.time())
) + tz_for_log,
- method, path, self.reply_code, bytes
+ method, path, self.reply_code, bytes,
+ referer, user_agent
)
)