diff options
-rwxr-xr-x | syntax-highlighting-server.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/syntax-highlighting-server.py b/syntax-highlighting-server.py index 89377c1..48482cc 100755 --- a/syntax-highlighting-server.py +++ b/syntax-highlighting-server.py @@ -35,6 +35,9 @@ class HighlightingHTTPServer(HTTPServer): self.formatter = formatter self.style_defs = style_defs + def log_message(self, format, *args): + logging.info("%s %s" % (self.address_string(), format % args)) + class HighlightingHandler(BaseHTTPRequestHandler): # read by BaseHTTPRequestHandler. need this so that curl doesn't delay # waiting for 100-continue @@ -69,8 +72,8 @@ class HighlightingHandler(BaseHTTPRequestHandler): lexer = guess_lexer(data) except ClassNotFound: lexer = TextLexer() - self.wfile.write('<!-- Lexer: ' + lexer.name + - ' (' + lexer.__class__.__name__ + ') -->') + self.wfile.write(('<!-- Lexer: ' + lexer.name + + ' (' + lexer.__class__.__name__ + ') -->').encode('utf-8')) self.wfile.write(self.server.style_defs) highlight(data, lexer, self.server.formatter, outfile=self.wfile) |