using System; namespace Log /// <summary> /// <summary> /// <summary>
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
{
class LogWirter
{
/// <summary>
/// 事件源名称
/// </summary>
private string eventSourceName;
EventLogEntryType eventLogType;
public LogWirter()
{
eventSourceName = “test”;
eventLogType = EventLogEntryType.Error;
}
/// 消息事件源名称
/// </summary>
public string EventSourceName
{
set { eventSourceName = value; }
}
/// 消息事件类型
/// </summary>
public EventLogEntryType EventLogType
{
set { eventLogType = value; }
}
/// 写入系统日志
/// </summary>
/// <param name=”message”>事件内容</param>
public void LogEvent(string message)
{
if (!EventLog.SourceExists(eventSourceName))
{
EventLog.CreateEventSource(eventSourceName, “Application”);
}
EventLog.WriteEntry(eventSourceName, message, EventLogEntryType.Error);
}
}
}
c#写系统日志_c#应用
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » c#写系统日志_c#应用
相关推荐
- 暂无文章
