mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
Revert "fix(logging): 🐛 try alt AppInsights IKey init"
This reverts commit cd9cdcd538.
This commit is contained in:
parent
b032d4576f
commit
cd343a7a72
1 changed files with 7 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.ApplicationInsights;
|
||||
using Microsoft.ApplicationInsights.Extensibility;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Serilog;
|
||||
|
|
@ -17,13 +18,16 @@ public static async Task TryRunWithLoggingAsync(this IHost host, Func<Task>? run
|
|||
.WriteTo.Conditional(
|
||||
_ => host.Services.GetService<IHostEnvironment>().IsProduction(),
|
||||
c => c.ApplicationInsights(
|
||||
((IConfiguration)host.Services.GetService(typeof(IConfiguration)))[
|
||||
"ApplicationInsights:InstrumentationKey"],
|
||||
host.Services.GetRequiredService<TelemetryConfiguration>(),
|
||||
TelemetryConverter.Traces))
|
||||
.CreateLogger();
|
||||
|
||||
try
|
||||
{
|
||||
// TODO: rm, for debugging
|
||||
var client = host.Services.GetService<TelemetryClient>();
|
||||
Log.Warning("Application Insights Instrumentation Key: {InstrumentationKey}", client.InstrumentationKey);
|
||||
|
||||
if (runPreHostAsync != null)
|
||||
{
|
||||
Log.Information("Initializing pre-host");
|
||||
|
|
|
|||
Loading…
Reference in a new issue