Don't log objects directly

We might hang on to objects that have been logged, causing a memory leak
at least when we're debugging.

/cc @hampelm