summaryrefslogtreecommitdiff
path: root/django/utils/log.py
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2022-01-12 12:04:14 +0000
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-01-12 20:23:42 +0100
commit90cf96326432df56a1cf981df215b83f4e993bfd (patch)
tree8c945fee178c3c183e4e04dc6a0bf94fde05b389 /django/utils/log.py
parentd05ab13c56849ed09d02c1f188b7f47f0c090a2a (diff)
Changed django.utils.log.log_response() to take exception instance.
There's little point retrieving a fresh reference to the exception in the legacy tuple format, when it's all available via the exception instance we already have.
Diffstat (limited to 'django/utils/log.py')
-rw-r--r--django/utils/log.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/django/utils/log.py b/django/utils/log.py
index 7c16fc6b12..5a5decd531 100644
--- a/django/utils/log.py
+++ b/django/utils/log.py
@@ -199,7 +199,7 @@ class ServerFormatter(logging.Formatter):
return self._fmt.find('{server_time}') >= 0
-def log_response(message, *args, response=None, request=None, logger=request_logger, level=None, exc_info=None):
+def log_response(message, *args, response=None, request=None, logger=request_logger, level=None, exception=None):
"""
Log errors based on HttpResponse status.
@@ -209,8 +209,8 @@ def log_response(message, *args, response=None, request=None, logger=request_log
"""
# Check if the response has already been logged. Multiple requests to log
# the same response can be received in some cases, e.g., when the
- # response is the result of an exception and is logged at the time the
- # exception is caught so that the exc_info can be recorded.
+ # response is the result of an exception and is logged when the exception
+ # is caught, to record the exception.
if getattr(response, '_has_been_logged', False):
return
@@ -228,6 +228,6 @@ def log_response(message, *args, response=None, request=None, logger=request_log
'status_code': response.status_code,
'request': request,
},
- exc_info=exc_info,
+ exc_info=exception,
)
response._has_been_logged = True