--- a/mercurial/hgweb.py Sun Jul 03 20:49:48 2005 -0800
+++ b/mercurial/hgweb.py Sun Jul 03 20:51:05 2005 -0800
@@ -694,12 +694,22 @@
else:
write(self.t("error"))
-def create_server(path, name, templates, address, port):
+def create_server(path, name, templates, address, port,
+ accesslog = sys.stdout, errorlog = sys.stderr):
import BaseHTTPServer
- import sys, os
class hgwebhandler(BaseHTTPServer.BaseHTTPRequestHandler):
+ def log_error(self, format, *args):
+ errorlog.write("%s - - [%s] %s\n" % (self.address_string(),
+ self.log_date_time_string(),
+ format % args))
+
+ def log_message(self, format, *args):
+ accesslog.write("%s - - [%s] %s\n" % (self.address_string(),
+ self.log_date_time_string(),
+ format % args))
+
def do_POST(self):
try:
self.do_hgweb()
@@ -761,6 +771,8 @@
hg = hgweb(path, name, templates)
return BaseHTTPServer.HTTPServer((address, port), hgwebhandler)
-def server(path, name, templates, address, port):
- httpd = create_server(path, name, templates, address, port)
+def server(path, name, templates, address, port,
+ accesslog = sys.stdout, errorlog = sys.stderr):
+ httpd = create_server(path, name, templates, address, port,
+ accesslog, errorlog)
httpd.serve_forever()