Skip to content

Commit

Permalink
Simplify LoggerService and correct SentryTarget usage
Browse files Browse the repository at this point in the history
  • Loading branch information
mhmd-azeez committed Feb 10, 2017
1 parent d937578 commit f77664c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
8 changes: 1 addition & 7 deletions Permadelete.FrontEnd/NLog/SentryTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,9 @@ public SentryTarget()
protected override void Write(LogEventInfo logEvent)
{
if (logEvent.Exception == null)
{
var message = Layout.Render(logEvent);
SendRaven(message, logEvent.Level);
}
SendRaven(logEvent.FormattedMessage, logEvent.Level);
else
{
SendRaven(logEvent.Exception);
}

}

private void SendRaven(string message, LogLevel level)
Expand Down
16 changes: 2 additions & 14 deletions Permadelete.FrontEnd/Services/LoggerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,28 +42,16 @@ public void Warning(Exception ex)
_logger.Warn(ex);
}

public void Info(string message) => Info(() => message);
public void Info(Func<string> messageFunction)
public void Info(string message)
{
_logger.Info(messageFunction);
_logger.Info(message);
}

public void Error(string message) => Error(() => message);
public void Error(Func<string> messageFunction)
{
_logger.Error(messageFunction);
}
public void Error(Exception ex)
{
_logger.Error(ex);
}

public void Fatal(string message) => Fatal(() => message);
public void Fatal(Func<string> messageFunction)
{
_logger.Fatal(messageFunction);
}

public async Task SendRaven(string message) => await SendRaven(message, ErrorLevel.Info);
public async Task SendRaven(string message, ErrorLevel level)
{
Expand Down

0 comments on commit f77664c

Please sign in to comment.