django icon indicating copy to clipboard operation
django copied to clipboard

Fixed #25704 -- Added response time in runserver logs.

Open tushar5526 opened this issue 1 year ago • 5 comments

Override log_request as log_request is called by log_response and format the message to include time for request completion plus some WSGI server overhead.

tushar5526 avatar Oct 12 '23 17:10 tushar5526

@tushar5526 Nice work! I think this will need a test before it can be merged though.

For other readers, here's a link to the ticket: https://code.djangoproject.com/ticket/25704

LilyFoote avatar Oct 18 '23 09:10 LilyFoote

@LilyFoote I have updated the tests. Will it be a good idea to convert the response time from ms to seconds (s) if the response time >= 1 second?

tushar5526 avatar Oct 18 '23 16:10 tushar5526

If it doesn't complicate the code too much, that sounds like a nice quality of life improvement.

LilyFoote avatar Oct 18 '23 16:10 LilyFoote

Hi @tushar5526 👋 great to see you! Can you add to the django.server logging docs that response time is also included (https://docs.djangoproject.com/en/dev/ref/logging/#django-server). It will also need a .. versionchanged:: 5.1 note and a mention in the 5.1 release notes 👍

sarahboyce avatar Oct 25 '23 15:10 sarahboyce

Hey @sarahboyce :) I have added the required doc changes. Thanks for reviewing!

tushar5526 avatar Oct 26 '23 13:10 tushar5526