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); } } }
public void SetUp() { SerilogConfig.Init(); parser = new WhoisParser(); }
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); } } }