private static void LogObject() { var thing = new Thing() { Color = "Red", Height = 23.5, Id = 1, Name = "Thing1" }; Logger4Net.Info($"thing: {thing}"); Serilogger.Information("{@Thing}", thing); }
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); }