Mercurial > hg
diff mercurial/hgweb/server.py @ 5549:f2f42262adbd
hgweb.server: flush log files after every access
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Tue, 27 Nov 2007 23:55:03 +0100 |
parents | ff461baa9c4e |
children | d74fc8dec2b4 |
line wrap: on
line diff
--- a/mercurial/hgweb/server.py Sun Nov 25 12:17:30 2007 +0100 +++ b/mercurial/hgweb/server.py Tue Nov 27 23:55:03 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: