Description
Is your feature request related to a problem? Please describe.
The way RequestLoggingMiddleware
currently fetches the ILogger
instance is through the options class and fallback to the static logger. I believe this design forces unnecessary changes when using non-static registrations for Serilog as it forces one to manually pass in the ILogger
instance on the UseSerilogRequestLogging
call.
Describe the solution you'd like
Make it so that ILogger
is injected into the middleware by the standard dependency injection mechanism, so that any registered ILogger
is naturally used without requiring manual wiring.
Describe alternatives you've considered
I'm personally not fond of dealing with static variables, so while I understand this is not an issue when using Log.Logger
, I'd rather not do that in my projects if at all possible.
To make it work, I had to manually inject ILogger
into the Configure
method and pass it along in the configuration delegate.