System Diagnostics C# by API

using System;
using System.Diagnostics;
class MainClass {
    public static void Main() {
        string source = "EventSource";
        string log = "MainClass.LOG";
        EventLog el = new EventLog();
        if (!EventLog.SourceExists(source)) {
            EventLog.CreateEventSource(source, log);
        }
        el.Source = source;
        String message = "Starting Up";
        el.WriteEntry(message, EventLogEntryType.Information);
        message = "Processing";
        el.WriteEntry(message, EventLogEntryType.Information);
        message = "Shutting down";
        el.WriteEntry(message, EventLogEntryType.Information);
        el = new EventLog();
        if (!EventLog.SourceExists(source)) {
            Console.WriteLine("Event Log does not exist!");
            return;
        }
        el.Source = source;
        foreach (EventLogEntry entry in el.Entries) {
            Console.WriteLine("\tEntry: " + entry.Message);
        }
        EventLog.Delete(log);
    }
}