Hi,
I'm trying to reformat the output data sent to the logger based on it's class.
For example:
- strings will be printed as they are
- dictionaries/lists will be automatically indented/beautified into html
- my custom classes will be handled on an individual basis and converted to html
My problem is that the message sent to the formatter is always a string. The documentation specifically says that you can send objects as messages, but it seems to be converting the objects to strings before I can format them.
class MyFormatter(logging.Formatter):
def format(self, record):
#The problem is that record.message is already a string...
...
Where is the appropriate place for me to handle objects sent as messages?