eliot
eliot copied to clipboard
MemoryLogger logs whole objects rather than serialized fields
When trying to write unit tests for an ActionType
I was surprised that I was getting the logged object in the logger
, rather than the serialized form.
I've written a failing test that shows this.
I'm not 100% sure it's a code bug though, because while writing this I found MemoryLogger.serialize
, which seems to get me the behaviour I want. At the very least, it's a documentation bug, because the page on unit testing your logging is silent on the subject of serialization.
I believe this is intentional because it is often useful to have access to the to-be-serialized object rather than the lossy serialized data.
Although being able to test against the serialized task is useful too, which #95 addresses.
Well, there's a serialize
method, which would address it too, and with less code than #95. Although it would still need to be documented somewhere other than the source code.
If it's intentional behaviour, then the guide on unit testing your logging should probably be updated.