public void Dump(string message, SeverityLevel severity) { string source = "EvlWatcher"; string log = "Application"; if (severity >= LogLevel) { //you must run this as admin for the first time - so that the eventlog source can be created if (!EventLog.SourceExists(source)) { EventLog.CreateEventSource(source, log); } EventLog.WriteEntry(source, message, SeverityToEventLogEntryType.Convert(severity)); } var date = DateTime.Now; if (Environment.UserInteractive) { Console.WriteLine($"{date.Hour}:{date.Minute}:{date.Second},{date.Millisecond} {message}"); } ManageConsoleHistory(message, severity, date); }
public void Dump(string message, SeverityLevel severity) { string source = "EvlWatcher"; string log = "Application"; if (severity >= LogLevel) { //you must run this as admin for the first time - so that the eventlog source can be created if (!EventLog.SourceExists(source)) { EventLog.CreateEventSource(source, log); } EventLog.WriteEntry(source, message, SeverityToEventLogEntryType.Convert(severity)); } if (severity >= ConsoleLevel) { Console.WriteLine($"{DateTime.Now.Hour}:{DateTime.Now.Minute}:{DateTime.Now.Second},{DateTime.Now.Millisecond} {message}"); } }