You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#8 fixes the exception that can happen when you log objects. What'd be even nicer, as @jezdez pointed out, would be to handle datetimes/dates : currently they are serialized as "datetime.datetime(2017, 4, 6, 9, 27, 7, 479427)" because that's the repr() for a datetime object, but we could do better by using DjangoJSONEncoder, which knows how to handle those objects and more.
One problem with that approach: at the moment src/dockerflow/logging.py is generic, does not depend on django. Not sure how to refactor that in a clean way.
@diox Oh, we'd have to ship an own encoder, literally just copy/pasting from Django. I think I've seen similar encoders in non-Django projects, so no huge problem.
#8 fixes the exception that can happen when you log objects. What'd be even nicer, as @jezdez pointed out, would be to handle datetimes/dates : currently they are serialized as
"datetime.datetime(2017, 4, 6, 9, 27, 7, 479427)"
because that's therepr()
for adatetime
object, but we could do better by usingDjangoJSONEncoder
, which knows how to handle those objects and more.Something like this should work, to test:
Then use
cls=SafeDjangoJSONEncoder
when doing thejson.dumps
.The text was updated successfully, but these errors were encountered: