public void When_logging_using_fatal() { _logger.Fatal("Hi"); _mockedInnerLogger.Verify(l => l.Log(typeof(Log4NetLogger), Level.Fatal, "Hi", null), Times.Once); var ex = new InvalidOperationException(); _logger.Fatal("Ooops", ex); _mockedInnerLogger.Verify(l => l.Log(typeof(Log4NetLogger), Level.Fatal, "Ooops", ex), Times.Once); _logger.FatalFormat("E:{0}", 1); _mockedInnerLogger.Verify(l => l.Log(typeof(Log4NetLogger), Level.Fatal, It.IsAny <string>(), null), Times.Exactly(2)); _logger.FatalFormat("E:{0}, {1}", 1, 2); _mockedInnerLogger.Verify(l => l.Log(typeof(Log4NetLogger), Level.Fatal, It.IsAny <string>(), null), Times.Exactly(3)); _logger.FatalFormat("E:{0}, {1}, {2}", 1, 2, 3); _mockedInnerLogger.Verify(l => l.Log(typeof(Log4NetLogger), Level.Fatal, It.IsAny <string>(), null), Times.Exactly(4)); _logger.FatalFormat("E:{0}, {1}, {2}, {3}, {4}", 1, 2, 3, 4, 5); _mockedInnerLogger.Verify(l => l.Log(typeof(Log4NetLogger), Level.Fatal, It.IsAny <string>(), null), Times.Exactly(5)); var italianCulture = new CultureInfo("it-It"); var date = new DateTime(2000, 12, 28, 1, 4, 43, 0); _logger.FatalFormat(italianCulture, "Date: {0}", date); _mockedInnerLogger.Verify(l => l.Log(typeof(Log4NetLogger), Level.Fatal, It.IsAny <string>(), null), Times.Exactly(6)); }
private void Log(string message) { switch (_level) { case EasyLogLevel.Debug: _logger.Debug(message); break; case EasyLogLevel.Info: _logger.Info(message); break; case EasyLogLevel.Warn: _logger.Warn(message); break; case EasyLogLevel.Error: _logger.Error(message); break; case EasyLogLevel.Fatal: _logger.Fatal(message); break; } }