当前位置:首页 > Windows程序 > 正文

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

2024-03-31 Windows程序

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

技术分享图片

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

标签:

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

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/33641.html

Jm-杰米博客Jamie
草根站长的技术交流乐园!IT不会不要紧快来好好学习吧!
  • 20786文章总数
  • 7494587访问次数
  • 建站天数
  • 友情链接