Merge with crew-stable
authorPatrick Mezard <pmezard@gmail.com>
Wed, 28 Nov 2007 00:11:55 +0100
changeset 5557 c47484fab02e
parent 5556 61fdf2558c0a (current diff)
parent 5549 f2f42262adbd (diff)
child 5562 72cb6bde5355
Merge with crew-stable
--- a/mercurial/hgweb/server.py	Tue Nov 27 09:44:09 2007 -0800
+++ b/mercurial/hgweb/server.py	Wed Nov 28 00:11:55 2007 +0100
@@ -44,17 +44,17 @@
         self.protocol_version = 'HTTP/1.1'
         BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kargs)
 
+    def _log_any(self, fp, format, *args):
+        fp.write("%s - - [%s] %s\n" % (self.client_address[0],
+                                       self.log_date_time_string(),
+                                       format % args))
+        fp.flush()
+
     def log_error(self, format, *args):
-        errorlog = self.server.errorlog
-        errorlog.write("%s - - [%s] %s\n" % (self.client_address[0],
-                                             self.log_date_time_string(),
-                                             format % args))
+        self._log_any(self.server.errorlog, format, *args)
 
     def log_message(self, format, *args):
-        accesslog = self.server.accesslog
-        accesslog.write("%s - - [%s] %s\n" % (self.client_address[0],
-                                              self.log_date_time_string(),
-                                              format % args))
+        self._log_any(self.server.accesslog, format, *args)
 
     def do_write(self):
         try: