-
Notifications
You must be signed in to change notification settings - Fork 287
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,12 +68,9 @@ public string ConnectionString | |
public IList<TargetPropertyWithContext> ContextProperties { get; } = new List<TargetPropertyWithContext>(); | ||
|
||
/// <summary> | ||
/// Gets the logging controller we will be using. | ||
/// Gets or sets the factory for creating TelemetryClient, so unit-tests can assign in-memory-channel | ||
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net462)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net462)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net462)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net462)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, netcoreapp3.1)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, netcoreapp3.1)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, netcoreapp3.1)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, netcoreapp3.1)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net8.0)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net8.0)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net8.0)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net8.0)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net481)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net481)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net481)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net481)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net6.0)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net6.0)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net6.0)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net6.0)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net472)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net472)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net472)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net472)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net7.0)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net7.0)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net7.0)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net7.0)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net452)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net452)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net452)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net452)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net480)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net480)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net480)
Check failure on line 71 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net480)
|
||
/// </summary> | ||
internal TelemetryClient TelemetryClient | ||
{ | ||
get { return this.telemetryClient; } | ||
} | ||
internal Func<TelemetryConfiguration, TelemetryClient> TelemetryClientFactory { get; set; } = new Func<TelemetryConfiguration, TelemetryClient>((cfg) => new TelemetryClient(cfg)); | ||
|
||
internal void BuildPropertyBag(LogEventInfo logEvent, ITelemetry trace) | ||
{ | ||
|
@@ -134,7 +131,7 @@ protected override void InitializeTarget() | |
{ | ||
var telemetryConfiguration = TelemetryConfiguration.CreateDefault(); | ||
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net462)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net462)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net462)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net462)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, netcoreapp3.1)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, netcoreapp3.1)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, netcoreapp3.1)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, netcoreapp3.1)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net8.0)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net8.0)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net8.0)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net8.0)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net481)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net481)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net481)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net481)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net6.0)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net6.0)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net6.0)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net6.0)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net472)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net472)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net472)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net472)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net7.0)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net7.0)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net7.0)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net7.0)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net452)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net452)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net452)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net452)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net480)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net480)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net480)
Check warning on line 132 in LOGGING/src/NLogTarget/ApplicationInsightsTarget.cs GitHub Actions / build-test-LOGGING (windows-latest, net480)
|
||
telemetryConfiguration.ConnectionString = connectionString; | ||
this.telemetryClient = new TelemetryClient(telemetryConfiguration); | ||
this.telemetryClient = this.TelemetryClientFactory(telemetryConfiguration); | ||
} | ||
else | ||
{ | ||
|
@@ -187,7 +184,7 @@ protected override void FlushAsync(AsyncContinuation asyncContinuation) | |
|
||
try | ||
{ | ||
this.TelemetryClient.FlushAsync(System.Threading.CancellationToken.None).ContinueWith(t => asyncContinuation(t.Exception)); | ||
this.telemetryClient.FlushAsync(System.Threading.CancellationToken.None).ContinueWith(t => asyncContinuation(t.Exception)); | ||
} | ||
catch (Exception ex) | ||
{ | ||
|