public static void CreateEventlogEntry(EventLogSource eventLogSource, string message)
{
EventLog eventLog = new EventLog();
try
{
string eventLogName = eventLogSource.ToString();
try
{
if (!EventLog.SourceExists(eventLogName))
{
EventLog.CreateEventSource(eventLogName, "Application");
}
}
catch { }
eventLog.Source = eventLogName;
eventLog.WriteEntry(message, EventLogEntryType.Error);
}
catch { }
}
No comments:
Post a Comment