better logging

This commit is contained in:
j 2016-04-05 01:28:55 +02:00
commit 6eff308468
2 changed files with 9 additions and 10 deletions

View file

@ -245,7 +245,7 @@ class Handler(http.server.SimpleHTTPRequestHandler):
}
self.write_response(response_status, content)
return
logger.debug('NODE action %s %s (%s)', action, args, user_id)
logger.debug('%s requests %s%s', user_id, action, args)
if action == 'ping':
content = {
'status': 'ok'
@ -267,9 +267,11 @@ class Handler(http.server.SimpleHTTPRequestHandler):
self.send_header('Content-Type', 'application/json')
content = json.dumps(content, ensure_ascii=False).encode('utf-8')
content = self.gzip_data(content)
self.send_header('Content-Length', str(len(content)))
content_length = len(content)
self.send_header('Content-Length', str(content_length))
self.end_headers()
self.wfile.write(content)
logger.debug('%s bytes response', content_length)
def chunk_size(self, content_length):
return min(16*1024, content_length)