⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 errorlog.cs

📁 用vs2005写的一个生产任务管理系统。数据的统计和综合查询是主要功能
💻 CS
字号:
using System; 
using System.Diagnostics;

namespace RWSB.Modules
{
	/// <summary>
	/// errorLog 的摘要说明。
	/// </summary>
	public class ErrorLog
	{
		public ErrorLog()
		{
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}
		public static void WriteLog(string Message,System.Diagnostics.EventLogEntryType EventLogEntryType)
		{
			System.Diagnostics.EventLog oEventLog=new EventLog();
			try
			{
				if (!EventLog.SourceExists("RWSB"))
				{
					EventLog.CreateEventSource("RWSB","供电设备检修生产任务管理系统");
				}
			
				oEventLog.Source="RWSB";
				oEventLog.WriteEntry(Message,EventLogEntryType);
			}
			catch{}
		}
		public static void WriteLog(string Message)
		{
			System.Diagnostics.EventLog oEventLog=new EventLog();
			try
			{
				if (!EventLog.SourceExists("RWSB"))
				{
					EventLog.CreateEventSource("RWSB","供电设备检修生产任务管理系统");
				}
			
				oEventLog.Source="RWSB";
				oEventLog.WriteEntry(Message,System.Diagnostics.EventLogEntryType.Error);
			}
			catch{
			
			}
		}
		public static void WriteLog(string ModuleName,string Message,System.Diagnostics.EventLogEntryType EventLogEntryType)
		{
			System.Diagnostics.EventLog oEventLog=new EventLog();
			try
			{
				if (!EventLog.SourceExists("RWSB"))
				{
					EventLog.CreateEventSource("RWSB","供电设备检修生产任务管理系统");
				}
			
				oEventLog.Source="OI";
				oEventLog.WriteEntry("发生模块:"+ModuleName+"\n"+Message,EventLogEntryType);
			}
			catch{
			
			}
		}
		public static void WriteLog(string ModuleName,string Message)
		{
			
			System.Diagnostics.EventLog oEventLog=new EventLog();
			try
			{
				if (!EventLog.SourceExists("RWSB"))
				{
					EventLog.CreateEventSource("RWSB","供电设备检修生产任务管理系统");
				}
				oEventLog.Source="RWSB";
				oEventLog.WriteEntry("发生模块:"+ModuleName+"\n"+Message,System.Diagnostics.EventLogEntryType.Error);
			}
			catch{
			
			}
		}

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -