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
Hi, I'm wanting to use the serilog-aspnetcore package and am following instructions in the readme file but am stumbling on this line
Remove ILoggerFactory parameters and any Add*() calls on the logger factory in Startup.cs
I have this line in my startup.cs for registering a custom modelbinderprovider
services.AddMvc().AddMvcOptions(options => {
options.ModelBinderProviders.Insert(0, new GenericViewModelBinderProvider(loggerFactory));
})"
I need to pass an ILoggerFactory because GenericViewModelBinderProvider creates a new type of modelbinder which inherits from ComplexTypeModelBinder, which needs an ILoggerFactory.
My question is why do we need to remove ILoggerFactory parameters from the Startup.cs file. It would seem to me that if and what is the best method for getting the serilog logger factory within the configureservices method?
I hope this makes sense. Thank you for your time.
The text was updated successfully, but these errors were encountered:
I think this should work just fine, in your scenario. The advice you mention in the README is a little outdated, from a time when the default ASP.NET Core project template included a bunch of framework-specific logger setup based on ILoggerFactory, along the lines of AddConsole(), AddDebug() etc.
Thank you! I figured it would work fine but I wanted to confirm there wouldn't be any hidden conflict that I wouldn't be able to find until I got into production.
Uh oh!
There was an error while loading. Please reload this page.
Hi, I'm wanting to use the serilog-aspnetcore package and am following instructions in the readme file but am stumbling on this line
I have this line in my startup.cs for registering a custom modelbinderprovider
I need to pass an ILoggerFactory because GenericViewModelBinderProvider creates a new type of modelbinder which inherits from ComplexTypeModelBinder, which needs an ILoggerFactory.
My question is why do we need to remove ILoggerFactory parameters from the Startup.cs file. It would seem to me that if and what is the best method for getting the serilog logger factory within the configureservices method?
I hope this makes sense. Thank you for your time.
The text was updated successfully, but these errors were encountered: