Skip to content

Instantly share code, notes, and snippets.

@c0shea
Created April 5, 2017 01:23
Show Gist options
  • Save c0shea/43e51c671681d6a1a3d85d9be0e93ea1 to your computer and use it in GitHub Desktop.
Save c0shea/43e51c671681d6a1a3d85d9be0e93ea1 to your computer and use it in GitHub Desktop.
public static class LoggerExtensions
{
public static void Trace(this Logger logger, Exception exception, LogMessageGenerator messageFunc)
{
if (logger.IsTraceEnabled)
{
if (messageFunc == null)
{
throw new ArgumentNullException("messageFunc");
}
logger.Trace(exception, messageFunc());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment