type);}}} 左侧栏里面的叫做LogName

时间:2022-03-14 02:26:36

public class LisaEventLog { private readonly string _logName = @"Lisa"; public string LogName => _logName; public LisaEventLog() { } public LisaEventLog(string logName) { _logName = logName; } public void WriteEntry(string error, EventLogEntryType type) { var sourceName = AppDomain.CurrentDomain.FriendlyName; if (!EventLog.SourceExists(sourceName)) { EventLog.CreateEventSource(sourceName, _logName); } using (EventLog eventLog = new EventLog(_logName)) { eventLog.Source = sourceName; var message = $"{AppDomain.CurrentDomain.BaseDirectory}{Environment.NewLine}{error}"; eventLog.WriteEntry(message, type); } } }

左侧栏里面的叫做LogName,每一条event log中的source列,,对应的是source

type);}}} 左侧栏里面的叫做LogName

这里的entries是指event log,好比上图中对应有5个。

标签:

原文地点:https://www.cnblogs.com/chucklu/p/8856645.html