From 768b852eecc2601b74b74155ed741bdc23501e15 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sun, 3 Apr 2016 21:02:35 -0700 Subject: [PATCH] Add length to access log --- daphne/access.py | 1 + daphne/http_protocol.py | 1 + 2 files changed, 2 insertions(+) diff --git a/daphne/access.py b/daphne/access.py index a3508ea..9bd1489 100644 --- a/daphne/access.py +++ b/daphne/access.py @@ -21,6 +21,7 @@ class AccessLogGenerator(object): date=datetime.datetime.now(), request="%(method)s %(path)s" % details, status=details['status'], + length=details['size'], ) # Websocket requests elif protocol == "websocket" and action == "connected": diff --git a/daphne/http_protocol.py b/daphne/http_protocol.py index 138aea1..0c47d66 100755 --- a/daphne/http_protocol.py +++ b/daphne/http_protocol.py @@ -176,6 +176,7 @@ class WebRequest(http.Request): "method": self.method.decode("ascii"), "client": "%s:%s" % (self.client.host, self.client.port), "time_taken": self.duration(), + "size": self.sentLength, }) else: logger.debug("HTTP response chunk for %s", self.reply_channel)