Created
March 10, 2018 04:56
-
-
Save heiswayi/389b52c5dfebef7d5367a64e51234d0a to your computer and use it in GitHub Desktop.
Simplest logger utility class using Windows built-in logging facility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
namespace SimplestLoggerUtility | |
{ | |
public static class Logger | |
{ | |
public static void Success(string message) | |
{ | |
EventLog.WriteEntry(AppDomain.CurrentDomain.FriendlyName, message, EventLogEntryType.Information); | |
} | |
public static void Failure(string message) | |
{ | |
EventLog.WriteEntry(AppDomain.CurrentDomain.FriendlyName, message, EventLogEntryType.Error); | |
} | |
public static void Warning(string message) | |
{ | |
EventLog.WriteEntry(AppDomain.CurrentDomain.FriendlyName, message, EventLogEntryType.Warning); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment