Ejemplo n.º 1
0
 private static void LogToApplicationInsights(LoggerConfiguration config, HostConfig appSettings, SerilogConfig serilogConfig)
 {
     if (serilogConfig.WriteToAppInsights)
     {
         // TODO: TelemetryConverter should be configurable (defaulted to Trace)
         // Note: best practice is to use the existing Telemetry
         if (string.IsNullOrEmpty(TelemetryConfiguration.Active.InstrumentationKey))
         {
             // TODO get the instrumentation key from the config file
             // webHostBuilder.UseApplicationInsights("ba3d25ea-5b60-4d5d-9340-06326585e663");
             config.WriteTo.ApplicationInsights(appSettings.ApplicationInsights.InstrumentationKey, TelemetryConverter.Traces);
             config.WriteTo.ApplicationInsights(appSettings.ApplicationInsights.InstrumentationKey, TelemetryConverter.Events);
         }
         else
         {
             config.WriteTo.ApplicationInsights(TelemetryConfiguration.Active, TelemetryConverter.Traces);
             config.WriteTo.ApplicationInsights(TelemetryConfiguration.Active, TelemetryConverter.Events);
         }
     }
 }
Ejemplo n.º 2
0
        public void SetUp()
        {
            SerilogConfig.Init();

            parser = new WhoisParser();
        }
Ejemplo n.º 3
0
 private static void LogToApplicationInsights(LoggerConfiguration config, HostConfig appSettings, SerilogConfig serilogConfig)
 {
     if (serilogConfig.WriteToAppInsights)
     {
         // TODO: TelemetryConverter should be configurable (defaulted to Trace)
         // Note: best practice is to use the existing Telemetry
         if (string.IsNullOrEmpty(TelemetryConfiguration.Active.InstrumentationKey))
         {
             config.WriteTo.ApplicationInsights(appSettings.ApplicationInsights.InstrumentationKey, TelemetryConverter.Traces);
             config.WriteTo.ApplicationInsights(appSettings.ApplicationInsights.InstrumentationKey, TelemetryConverter.Events);
         }
         else
         {
             config.WriteTo.ApplicationInsights(TelemetryConfiguration.Active, TelemetryConverter.Traces);
             config.WriteTo.ApplicationInsights(TelemetryConfiguration.Active, TelemetryConverter.Events);
         }
     }
 }