Skip to content

Instantly share code, notes, and snippets.

@heiswayi
Created March 10, 2018 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heiswayi/389b52c5dfebef7d5367a64e51234d0a to your computer and use it in GitHub Desktop.
Save heiswayi/389b52c5dfebef7d5367a64e51234d0a to your computer and use it in GitHub Desktop.
Simplest logger utility class using Windows built-in logging facility
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