public static IServiceCollection AddDottyRequestTracing( this IServiceCollection builder, Action <DottyLogLoggerConfiguration> configure) { var config = new DottyLogLoggerConfiguration(); configure(config); builder.Configure(configure); builder.Configure <DottyLogLoggerConfiguration>(o => o.DottyAddress = config.DottyAddress); return(builder.AddDottyRequestTracing(config)); }
public static DottyLogLoggerProvider CreateProvider(DottyLogLoggerConfiguration config) { var sink = new DottyLogSink(config); return(new DottyLogLoggerProvider(config, sink)); }
private static IServiceCollection AddDottyRequestTracing(this IServiceCollection services, DottyLogLoggerConfiguration config) { services.AddHostedService(c => new MetricsAndHeartbeatBackgroundService(c.GetRequiredService <ILogger <MetricsAndHeartbeatBackgroundService> >(), config)); var sink = new DottyLogSink(config); services.AddLogging( b => b.AddProvider(new DottyLogLoggerProvider(config, sink))); services.AddScoped <DottyLogsScopedContext>(); services.AddSingleton <UpdatePusherService>(); services.AddScoped <DottyHeaderMessageHandler>(); services.AddHttpContextAccessor(); services.AddHttpClient(Microsoft.Extensions.Options.Options.DefaultName).AddDottyLog(); return(services); }
public DottyLogLogger( string name, DottyLogLoggerConfiguration config, DottyLogSink sink) => (_name, _config, _sink) = (name, config, sink);