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

            return(new DottyLogLoggerProvider(config, sink));
        }
Example #3
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);
        }
Example #4
0
 public DottyLogLogger(
     string name,
     DottyLogLoggerConfiguration config,
     DottyLogSink sink) =>
 (_name, _config, _sink) = (name, config, sink);