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 static DottyLogLoggerProvider CreateProvider(DottyLogLoggerConfiguration config) { var sink = new DottyLogSink(config); return(new DottyLogLoggerProvider(config, sink)); }
public DottyLogLogger( string name, DottyLogLoggerConfiguration config, DottyLogSink sink) => (_name, _config, _sink) = (name, config, sink);