国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

c#寫系統日志

2019-11-18 16:36:57
字體:
來源:轉載
供稿:網友

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace Log
{
    class LogWirter
    {
        /// <summary>
        /// 事件源名稱
        /// </summary>
        PRivate string eventSourceName;
        EventLogEntryType eventLogType;
        public LogWirter()
        {
            eventSourceName = "test";
            eventLogType = EventLogEntryType.Error;
        }

        /// <summary>
        /// 消息事件源名稱
        /// </summary>
        public string EventSourceName
        {
            set { eventSourceName = value; }
        }

        /// <summary>
        /// 消息事件類型
        /// </summary>
        public EventLogEntryType EventLogType
        {
            set { eventLogType = value; }
        }

        /// <summary>
        /// 寫入系統日志
        /// </summary>
        /// <param name="message">事件內容</param>
        public void LogEvent(string message)
        {
            if (!EventLog.SourceExists(eventSourceName))
            {
                EventLog.CreateEventSource(eventSourceName, "application");
            }
            EventLog.WriteEntry(eventSourceName, message, EventLogEntryType.Error);
        }
    }
}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 收藏| 康乐县| 股票| 德兴市| 会宁县| 灵武市| 开封市| 长治市| 潢川县| 革吉县| 元阳县| 托里县| 沭阳县| 河南省| 融水| 富川| 南郑县| 衡水市| 太和县| 青河县| 依兰县| 镇沅| 绥棱县| 麻栗坡县| 武平县| 家居| 马公市| 肃宁县| 仲巴县| 桂林市| 阿克陶县| 嘉峪关市| 刚察县| 伊川县| 台中县| 蒙阴县| 攀枝花市| 土默特右旗| 化德县| 保康县| 海门市|