diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2020-03-08 22:44:35 -0400 |
---|---|---|
committer | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2020-03-08 22:44:35 -0400 |
commit | bd11d3db31cc207d794d500c9caa3508e10dacb5 (patch) | |
tree | 64c8c26f29fbd427d6f59c7aadf7278827a0672e | |
parent | 503c7f30274fc4bb8b7719df56750a36c9b81ced (diff) | |
download | cgit-syntax-highlighting-bd11d3db31cc207d794d500c9caa3508e10dacb5.tar.xz cgit-syntax-highlighting-bd11d3db31cc207d794d500c9caa3508e10dacb5.zip |
redirect log_message to logging
-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) |