You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
The way
RequestLoggingMiddleware
currently fetches theILogger
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 theILogger
instance on theUseSerilogRequestLogging
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 registeredILogger
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 theConfigure
method and pass it along in the configuration delegate.The text was updated successfully, but these errors were encountered: