Namespace to import

[codesyntax lang=”csharp”]
using System.Diagnostics;
[/codesyntax]

Code to write to the application log, sure this is super simple but sometimes that’s all you need ;)

[codesyntax lang=”csharp”]
const string sSource = “Your Application name..”;
const string sLog = “Application”;

if (!EventLog.SourceExists(sSource))
EventLog.CreateEventSource(sSource, sLog);
EventLog.WriteEntry(sSource, “Text you want in the entry here”,
EventLogEntryType.Information, 0);
[/codesyntax]