Adds a DebugChannel for TelemetryClient

This commit is contained in:
Janus C. H. Knudsen 2025-02-05 18:38:29 +01:00
parent cdd645bb3b
commit b2c0919a8c
8 changed files with 203 additions and 47 deletions

View file

@ -0,0 +1,21 @@
using Microsoft.ApplicationInsights.Channel;
namespace Core.Telemetry
{
public class DebugTelemetryChannel : InMemoryChannel, ITelemetryChannel
{
private readonly string _filePath;
public ITelemetryChannel _defaultChannel;
public DebugTelemetryChannel(string filePath)
{
_filePath = filePath;
}
public new void Send(ITelemetry item)
{
base.Send(item);
var logEntry = $"{DateTime.UtcNow:u}|{item.Context.Operation.Name}|{item.Context.Operation.Id}";
//File.AppendAllText(_filePath, logEntry + Environment.NewLine);
}
}
}