Structlog seems to use __repr__
when creating log messages, which leads to date
and datetime
objects looking like 'datetime.datetime(2018, 9, 20, 10, 1, 52, 414750)'
where '2018-09-20 10:01:52.414750'
would be preferable.
I would have thought there would be an off the shelf processor to handle this, but I can't find one.
This is the solution I came up with, but I'm concerned about the performance given the highly recursive nature of it, and the unnecessary rebuilding of
list
anddict
objects.Then include
dates_to_str_filter
inprocessors
for thestructlog.configure
call.