I've currently got some code that looks like this:
_logger.LogInformation("Found a problem {Problem}", Format(problemDetails));
where Format converts ProblemDetails to a string.
I would like to register a handler within the logging framework to explain how this type should be serialized to string so that I could type
_logger.LogInformation("Found a problem {Problem}", problemDetails);
and not just get the result of calling .ToString(). Is this possible?
Just add an
@before theProblem. TheproblemDetailsis written as Json:Structured logging