When using Microsoft.Extensions.Logging in a .NET application, is there a way to get the current count of errors that have been written to the log?
I figure I can probably implement a custom ILogger that tracks the error count, but if this already exists out-of-the-box, I*d much prefer that.
It seems like this is where I'll need a custom
StatisticsLogger:Note: The intended use for this is in a simple console app that's going to run as a single instance. No attempt has been made to accomodate multi-threading!
A logger provider that retains the instance of the
StatisticsLogger:A helper for adding this to the
ApplicationHostBuilder:And using it in the
ProgramMain