Skip to content

Instantly share code, notes, and snippets.

@michaeljbailey
Created April 24, 2015 13:53
Show Gist options
  • Save michaeljbailey/1c60954bbe4230fb09c7 to your computer and use it in GitHub Desktop.
Save michaeljbailey/1c60954bbe4230fb09c7 to your computer and use it in GitHub Desktop.
Sensible log4net wrapper
using System;
using log4net;
using log4net.Config;
using log4net.Util;
[assembly: XmlConfigurator(Watch = true, ConfigFile = "log4net.config")]
namespace LogWrapper
{
public static class Logger
{
private static readonly ILog Log;
static Logger()
{
Log = LogManager.GetLogger("Default");
}
public static void DebugFormat(string format, params object[] args)
{
Log.DebugFormatExt(format, args);
}
public static void Debug(object message, Exception exception = null)
{
Log.DebugExt(message, exception);
}
public static void InfoFormat(string format, params object[] args)
{
Log.InfoFormatExt(format, args);
}
public static void Info(object message, Exception exception = null)
{
Log.InfoExt(message, exception);
}
public static void WarningFormat(string format, params object[] args)
{
Log.WarnFormatExt(format, args);
}
public static void Warning(object message, Exception exception = null)
{
Log.WarnExt(message, exception);
}
public static void ErrorFormat(string format, params object[] args)
{
Log.ErrorFormatExt(format, args);
}
public static void Error(object message, Exception exception = null)
{
Log.ErrorExt(message, exception);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment