How can I implement a serializer that handles any type of object without modifying the way to invoke the logger?