Without creating a brand new customer ILogger
type, is it possible to somehow register "formatters" for different parameter types?
Example:
double someVar = 10.3;
/*snip*/
logger.LogDebug("Look at this property {MyProp}", someVar);
Can I somehow change how the someVar
in this case is formatted by the logger?
AFAIK, it just defaults to ToString()
on each of the provided property values.
In my specific case, I want to change how protobuf messages are logged in properties.
So I would like to intercept the formatting of any IMessage
object, and apply custom formatting to those. using any existing logger that is.
Is that possible?