If you use django-structlog, this is a little extension that will populate the request_finished
log with the duration of the request (request_duration
).
Install the package.
pip install django-structlog-duration
Configure the middleware.
MIDDLEWARE = [
"django_structlog_duration.StartTimer",
# ...
"django_structlog.middlewares.RequestMiddleware",
"django_structlog_duration.StopTimer",
]