using System; using System.Collections.Generic; using System.Diagnostics.Tracing; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LogStudy.EventLog.Next { /// /// 日志接口 /// EventSource 类型可能实现接口,以便无缝集成到使用接口定义常用日志记录目标的各种高级日志记录系统中。 /// public interface ILogger { void Error(int errorCode, string msg); void Warning(string msg); } [EventSource(Name = "EventLogNext-InterfaceEventSource")] public class InterfaceEventSource : EventSource, ILogger { public InterfaceEventSource() { } public static InterfaceEventSource Logger { get; set; } = new InterfaceEventSource(); [Event(1)] public void Error(int errorCode, string msg) { WriteEvent(1, errorCode, msg); } [Event(2)] public void Warning(string msg) { WriteEvent(2, msg); } } }