Skip to content

Instantly share code, notes, and snippets.

@MiniverCheevy
Last active August 29, 2015 14:06
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 MiniverCheevy/4a72daeba29e482205ba to your computer and use it in GitHub Desktop.
Save MiniverCheevy/4a72daeba29e482205ba to your computer and use it in GitHub Desktop.
Voodoo.Logging.ILogger Implementations
public class ElmahLogger: Voodoo.Logging.ILogger
{
public void Log(string message)
{
using (var scope = new TransactionScope(TransactionScopeOption.Suppress))
{
var exception = new Exception(message);
ErrorSignal.FromCurrentContext().Raise(exception);
}
}
public void Log(Exception ex)
{
using (var scope = new TransactionScope(TransactionScopeOption.Suppress))
{
ErrorSignal.FromCurrentContext().Raise(ex);
}
}
}
public class NLogLogger : Voodoo.Logging.ILogger
{
private static Logger logger = LogManager.GetCurrentClassLogger();
public void Log(string message)
{
logger.Log(LogLevel.Error, message);
}
public void Log(Exception ex)
{
logger.Log(LogLevel.Error, ex.ToString());
}
}
public class ExceptionalLogger: Voodoo.Logging.ILogger
{
public void Log(string message)
{
ErrorStore.LogException(new Exception(message), HttpContext.Current);
}
public void Log(Exception ex)
{
ErrorStore.LogException(ex, HttpContext.Current);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment