Serilog clear providers from nuget package

25 Views Asked by At

this is my question :

I'm working creating a library to allow team to implements Opentelemtry exporter to the logs, in this particular case Using Serilog provider :

I want to override if exist any serilog configuration in the application and use the configuration that we are going to provide with the nuget package :

Insise the nuget package i thinking to use (just and example , i know i need to add the exporter , etc...):

Receiving the builder or the service in my method and do this :

var logger = new LoggerConfiguration()
    .WriteTo.Console()
    .WriteTo.File("", rollingInterval: RollingInterval.Day)
    .CreateLogger();
builder.Logging.ClearProviders();
builder.Logging.AddSerilog(logger);

This configuration happens before or after the configuration added directly on the api ?

0

There are 0 best solutions below