From bd11d3db31cc207d794d500c9caa3508e10dacb5 Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Sun, 8 Mar 2020 22:44:35 -0400 Subject: redirect log_message to logging --- syntax-highlighting-server.py | 7 +++++-- 1 file 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('') + self.wfile.write(('').encode('utf-8')) self.wfile.write(self.server.style_defs) highlight(data, lexer, self.server.formatter, outfile=self.wfile) -- cgit v1.2.3-70-g09d2