У меня есть этот класс:
public class TelemetryHelper : ITelemetryHelper
{
private TelemetryClient TelemetryClient { get; set; }
public TelemetryHelper()
{
TelemetryConfiguration configuration = TelemetryConfiguration.CreateDefault();
configuration.InstrumentationKey = ConfigurationManager.AppSettings["APPINSIGHTS_INSTRUMENTATIONKEY"];
TelemetryClient = new TelemetryClient(configuration);
}
#region Input
public Task InfoAsync(DebugMessageType tag = DebugMessageType.Other, string message = null, Exception ex = null, [CallerMemberName] string callerFunction = "", [CallerLineNumber] int lineNumber = 0)
=> OutputInApplicationInsightsAsync(SeverityLevel.Information, tag, message, ex, callerFunction);
public Task ErrorAsync(DebugMessageType tag = DebugMessageType.Other, string message = null, Exception ex = null, [CallerMemberName] string callerFunction = "", [CallerLineNumber] int lineNumber = 0)
=> OutputInApplicationInsightsAsync(SeverityLevel.Error, tag, message, ex, callerFunction);
public Task WarnAsync(DebugMessageType tag = DebugMessageType.Other, string message = null, Exception ex = null, [CallerMemberName] string callerFunction = "", [CallerLineNumber] int lineNumber = 0)
=> OutputInApplicationInsightsAsync(SeverityLevel.Warning, tag, message, ex, callerFunction);
#endregion Input
private Task OutputInApplicationInsightsAsync(SeverityLevel level, DebugMessageType tag = DebugMessageType.Other, string message = null, Exception ex = null, string callerFunction = "")
{
var properties = new Dictionary<string, string> { { "Tag", tag.ToString() } };
if (!string.IsNullOrWhiteSpace(callerFunction))
properties.Add("CallerFunction", callerFunction);
if (ex != null)
properties.Add("Exception", ex.ToString());
TelemetryClient.TrackTrace(message, level, properties);
return Task.CompletedTask;
}
}
И я могу использовать его следующим образом:
await TelemetryHelper.ErrorAsync(DebugMessageType.Service, ex.Message, ex, nameof(this.RunRemoveTasksAsync));
Однако кто-то может сказать мне, где эти журналы в Azure Portal. Я искал часы, которые не могу найти