I would like to help prevent our dev team from not using our structured logging set up. The correct way to log (for us) would be like this:
_logger.LogInformation("This is a message template with a {@StructuredField}", structuredFieldVariable);
An incorrect way to log it would be like this:
_logger.LogInformation($"this is a poorly constructed log message with a {variable} in the template");
I'm thinking a roslyn code analyzer could be written to check if any string interpolation is being done inside of _logger.LogInformation(). Would this be possible/feasible?
Thanks!