using System;
using System.Diagnostics;
namespace smsXmlWS
{
public class LogManager
{
// EventLogEntryType.Error
// EventLogEntryType.FailureAudit
// EventLogEntryType.Information
// EventLogEntryType.SuccessAudit
// EventLogEntryType.Warning
public LogManager()
{ }
public static void WriteLog(string message, EventLogEntryType eventType)
{
if (!System.Diagnostics.EventLog.SourceExists("
LOGNAME
"))
{
EventSourceCreationData data = new EventSourceCreationData("
LOGNAME
", "
LOGNAME
");
System.Diagnostics.EventLog.CreateEventSource(data);
}
if (eLog == null)
eLog = new System.Diagnostics.EventLog();
eLog.Source = "
LOGNAME
";
eLog.WriteEntry(message + " DATE : " + System.DateTime.Now.ToString(), eventType);
}
private static System.Diagnostics.EventLog eLog = null;
}
}