Add length to access log

This commit is contained in:
Andrew Godwin 2016-04-03 21:02:35 -07:00
parent 074f73acb4
commit 768b852eec
2 changed files with 2 additions and 0 deletions

View File

@ -21,6 +21,7 @@ class AccessLogGenerator(object):
date=datetime.datetime.now(), date=datetime.datetime.now(),
request="%(method)s %(path)s" % details, request="%(method)s %(path)s" % details,
status=details['status'], status=details['status'],
length=details['size'],
) )
# Websocket requests # Websocket requests
elif protocol == "websocket" and action == "connected": elif protocol == "websocket" and action == "connected":

View File

@ -176,6 +176,7 @@ class WebRequest(http.Request):
"method": self.method.decode("ascii"), "method": self.method.decode("ascii"),
"client": "%s:%s" % (self.client.host, self.client.port), "client": "%s:%s" % (self.client.host, self.client.port),
"time_taken": self.duration(), "time_taken": self.duration(),
"size": self.sentLength,
}) })
else: else:
logger.debug("HTTP response chunk for %s", self.reply_channel) logger.debug("HTTP response chunk for %s", self.reply_channel)