Wrapped logging of serialized data in if block