private static void LogException() { try { throw new ApplicationException("Exceptions happen!"); } catch (Exception exception) { Logger4Net.Error($"A {exception.GetType()} exception", exception); Serilogger.Error(exception, $"A {exception.GetType()} exception"); Serilogger.Debug("{@Exception}", exception); } }
private static void LogSimpleMessage() { string message = "There are many messages but this one is mine!"; Logger4Net.Info(message); Logger4Net.Debug(message); Logger4Net.Warn(message); Logger4Net.Error(message); Logger4Net.Fatal(message); Serilogger.Information(message); Serilogger.Debug(message); Serilogger.Warning(message); Serilogger.Error(message); Serilogger.Fatal(message); }
public void Error(string message) { Serilogger.Error(message); }
public void ErrorFormat(int eventId, string format, params object[] args) { Serilogger.Error("{EventID} - {Message}", eventId, String.Format(format, args)); }
public void ErrorFormat(string format, params object[] args) { Serilogger.Error("{message}", String.Format(format, args)); }
public void Error(int eventId, object message, Exception exception) { Serilogger.Error(exception, "{EventID} - {Message}", eventId, message); }
public void Error(int eventId, object message) { Serilogger.Error("{EventID} - {Message}", eventId, message); }
public void Error(object message, Exception exception) { Serilogger.Error(exception, "{message}", message); }
public void Error(object message) { Serilogger.Error("{message}", message); }