You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.6 KiB
C#

2 years ago
using System;
using System.Collections.Generic;
using System.Diagnostics.Tracing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LogStudy.EventLog.Next
{
/// <summary>
/// 高级事件源
/// </summary>
[EventSource(Name = "EventLogNext-AdvancedEventSource")]
public sealed class AdvancedEventSource : EventSource
{
private AdvancedEventSource() { }
public static AdvancedEventSource Logger { get; } = new AdvancedEventSource();
[Event(1, Task = Tasks.Request, Opcode = EventOpcode.Start)]
public void RequestStart(int RequestID, string Url)
{
WriteEvent(1, RequestID, Url);
}
[Event(2, Task = Tasks.Request, Opcode = EventOpcode.Info)]
public void RequestPhase(int RequestID, string PhaseName)
{
WriteEvent(2, RequestID, PhaseName);
}
[Event(3, Keywords = Keywords.Requests, Task = Tasks.Request, Opcode = EventOpcode.Stop)]
public void RequestStop(int RequestID)
{
WriteEvent(eventId: 3, RequestID);
}
/// <summary>
/// 自定义任务
/// </summary>
public class Tasks
{
public const EventTask Request = (EventTask)0x1;
}
/// <summary>
/// 自定义 关键字
/// </summary>
public class Keywords
{
public const EventKeywords Startup = (EventKeywords)0x0001;
public const EventKeywords Requests = (EventKeywords)0x0002;
public const EventKeywords AppStopd = (EventKeywords)0x0004;
}
}
}