#31537: Optionally log server_time with timezone
-------------------------------+--------------------------------------
Reporter: thenewguy | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by thenewguy):
This is an example of how the ServerFormatter can be made to output
server_time as somthing like 2020-05-05 13:12:39,637Z or
2020-05-05T13:12:39.637Z if you change the format string
{{{
from time import gmtime
from django.utils.log import ServerFormatter
class UTCServerFormatter(ServerFormatter):
default_time_format = '%Y-%m-%d %H:%M:%S'
default_msec_format = '%s,%03dZ'
converter = gmtime
}}}
This is fairly easy but took a fair amount of source code reading to put
together. I think it would be a good idea to be more flexible so I am
going to leave the issue open.
--
Ticket URL: <https://code.djangoproject.com/ticket/31537#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.6ef4d01f092bd4b5bf88daae8d56695f%40djangoproject.com.