Open displaced opened 5 years ago
I don't oppose including the enum but I fear that the __dict__
case changes the log structure for others that use the current repr
functionality. Thoughts?
Nit: would repr(dir(obj))
be preferrable to repr(obj.__dict__)
?
I don't oppose including the enum but I fear that the
__dict__
case changes the log structure for others that use the currentrepr
functionality. Thoughts?
Ah, yes -- definitely agree. Would you be happy with wrapping the original routine in a try/except, and putting the new stuff into the except block?
[EDIT: Apologies, I was answering from memory -- the serialisation doesn't happen in that function, so the exception won't happen there -- I'll have another think!]
Nit: would
repr(dir(obj))
be preferrable torepr(obj.__dict__)
?
I'll give it a go -- I was concerned that dir() might grab too much detail about the object, but let's see what it looks like.
Made smarter_repr smarter (handles enums and tries to use dict for other objects. Needed for my use-case of logging data from the
nameko-tracer
extension to thenameko
microservice framework)Told
GELFRabbitHandler
to use smarter_repr when serialising its final object