예제 #1
0
        private static void CreateSerilogLogger(WebHostBuilderContext builderContext, LoggerConfiguration config)
        {
            var configuration      = ConfigureBuilder.GetConfiguration(builderContext.HostingEnvironment);
            var instrumentationKey = configuration.GetValue <string>("ApplicationInsights:InstrumentationKey");

            config
            .ReadFrom.Configuration(configuration)
            .WriteTo.ApplicationInsights(instrumentationKey, TelemetryConverter.Events, Serilog.Events.LogEventLevel.Information)
            .WriteTo.ApplicationInsights(instrumentationKey, TelemetryConverter.Traces, Serilog.Events.LogEventLevel.Information)
            ;
        }
예제 #2
0
 public Startup(IHostEnvironment env)
 {
     Configuration = ConfigureBuilder.GetConfiguration(env);
     this._env     = env;
 }