public static ILoggingBuilder AddPetProjectLogging(this ILoggingBuilder builder, LogEventLevel minLevel, PeriodicSinkConfiguration sinkConfig, KafkaConfiguration kafkaConfig, string type, bool dispose = false) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } var logger = new LoggerConfiguration() .MinimumLevel.Is(minLevel) .Enrich.FromLogContext() .WriteTo.Kafka(sinkConfig, kafkaConfig, type) .CreateLogger(); builder.AddSerilog(logger, dispose); builder.SetMinimumLevel(minLevel.MapToNetCoreLogLevel()); return(builder); }