示例#1
0
        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);
        }
示例#2
0
        public static DottyLogLoggerProvider CreateProvider(DottyLogLoggerConfiguration config)
        {
            var sink = new DottyLogSink(config);

            return(new DottyLogLoggerProvider(config, sink));
        }
示例#3
0
 public DottyLogLogger(
     string name,
     DottyLogLoggerConfiguration config,
     DottyLogSink sink) =>
 (_name, _config, _sink) = (name, config, sink);