'.Net 6 send log to fluentd

I added to my application Serilog.Sinks.Fluentd. I have similar class like here LoggerConfigurationFluentdExtensions.cs.

In addition I wrote class with one method like this

public class LoggingConfigurationExtension
{
    public void UseFluentd(ref LoggerConfiguration loggerConfiguration, IConfiguration configuration)
    {
        var config = configuration.GetSection("Fluentd")
                            .Get<FluentdOptions>();


        loggerConfiguration.WriteTo.Fluentd(null, config.MinimumLevel ?? Serilog.Events.LogEventLevel.Debug);
    }
}

which get configuration from appsettings about fluent like host, port etc. Please tell me how to add this class during the starting application. Should I add in Startup class which section ConfigurationContainer or ConfigureServices ? or maybe in Program.cs ? I also use Autofac.

Thanks for your advice



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source