Open vikramsubramanian opened 3 months ago
emit
method in the custom handler class that inherits from logging.Handler
to ensure it does not apply additional formatting to the record.msg
.Formatter
associated with the custom handler is configured to use the desired format, which in this case should be just the message itself without any additional information like timestamp, level, or module.emit
method to directly use record.msg
when writing to the handler's sink.Formatter
that specifies the desired format string.format
parameter in the logger.add()
method to specify the format for each handler individually.
Reading
Record.msg
in a customlogging.Handler
implementation returns a formatted message instead of the original text. Since I need to use a different format for different handlers this is quite problematic. This is also different from the Python logging.Expected value:
"That's it, beautiful and simple logging!"
Actual value:
"2024-02-13 13:30:54.357 | DEBUG | __main__:run_it:31 - That's it, beautiful and simple logging!"
)