Функция на C# для записи данных программы в системный журнал.
public bool WriteEvent(string sEntry, string sAppName, EventLogEntryType eEventType, string sLogName)
{
EventLog oEventLog = new EventLog();
try {
//Register the Application as an Event Source
if (!EventLog.SourceExists(sAppName))
{
EventLog.CreateEventSource(sAppName, sLogName);
}
//log the entry
oEventLog.Source = sAppName;
oEventLog.WriteEntry(sEntry, eEventType);
return true;
}
catch (Exception Ex) {
MessageBox.Show(Ex.Message);
return false;
}
}