Skip to content

Issue with this: Remove ILoggerFactory parameters and any Add*() calls on the logger factory in Startup.cs #147

Closed
@daharmon

Description

@daharmon

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions