Created
August 6, 2009 13:50
-
-
Save ianoxley/163322 to your computer and use it in GitHub Desktop.
This file contains 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.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace Github.Gist.Logging { | |
public interface ILogger { | |
void Warn(string s); | |
void Warn(string s, Exception ex); | |
void WarnFormat(string s, params object [] args); | |
void Info(string s); | |
void Info(string s, Exception ex); | |
void InfoFormat(string s, params object[] args); | |
void Debug(string s); | |
void Debug(string s, Exception ex); | |
void DebugFormat(string s, params object[] args); | |
} | |
} |
This file contains 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 log4net; | |
using System.Reflection; | |
namespace Github.Gist.Logging { | |
/// <summary> | |
/// log4net wrapper to allow easier unit testing (by testing against the ILogger interface) | |
/// </summary> | |
public class Log4NetLogger : ILogger { | |
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | |
#region ILogger Members | |
public void Warn(string s) { | |
Log.Warn(s); | |
} | |
public void Warn(string s, Exception ex) { | |
Log.Warn(s, ex); | |
} | |
public void WarnFormat(string s, params object [] args) { | |
Log.WarnFormat(s, args); | |
} | |
public void Info(string s) { | |
Log.Info(s); | |
} | |
public void Info(string s, Exception ex) { | |
Log.Info(s, ex); | |
} | |
public void InfoFormat(string s, params object[] args) { | |
Log.InfoFormat(s, args); | |
} | |
public void Debug(string s) { | |
Log.Debug(s); | |
} | |
public void Debug(string s, Exception ex) { | |
Log.Debug(s, ex); | |
} | |
public void DebugFormat(string s, params object[] args) { | |
Log.DebugFormat(s, args); | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment