public void When_logging_using_warn() { _logger.Warn("Hi"); _mockedInnerLogger.Verify(l => l.Log(typeof(Log4NetLogger), Level.Warn, "Hi", null), Times.Once); var ex = new InvalidOperationException(); _logger.Warn("Ooops", ex); _mockedInnerLogger.Verify(l => l.Log(typeof(Log4NetLogger), Level.Warn, "Ooops", ex), Times.Once); _logger.WarnFormat("E:{0}", 1); _mockedInnerLogger.Verify(l => l.Log(typeof(Log4NetLogger), Level.Warn, It.IsAny <string>(), null), Times.Exactly(2)); _logger.WarnFormat("E:{0}, {1}", 1, 2); _mockedInnerLogger.Verify(l => l.Log(typeof(Log4NetLogger), Level.Warn, It.IsAny <string>(), null), Times.Exactly(3)); _logger.WarnFormat("E:{0}, {1}, {2}", 1, 2, 3); _mockedInnerLogger.Verify(l => l.Log(typeof(Log4NetLogger), Level.Warn, It.IsAny <string>(), null), Times.Exactly(4)); _logger.WarnFormat("E:{0}, {1}, {2}, {3}, {4}", 1, 2, 3, 4, 5); _mockedInnerLogger.Verify(l => l.Log(typeof(Log4NetLogger), Level.Warn, 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.WarnFormat(italianCulture, "Date: {0}", date); _mockedInnerLogger.Verify(l => l.Log(typeof(Log4NetLogger), Level.Warn, 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; } }
private void Run() { _logger.Info("Benchmarking starting"); TestThroughput(); // TestMultiThreading(); // TestIdle(); _logger.Warn("Benchmarking ended"); }
private void Run() { _logger.Info("Benchmarking starting"); TestThroughput(); // TestMultiThreading(); // TestIdle(); _logger.Warn("Benchmarking ended"); Console.WriteLine("Gen 0: {0}", GC.CollectionCount(0).ToString()); Console.WriteLine("Gen 1: {0}", GC.CollectionCount(1).ToString()); Console.WriteLine("Gen 2: {0}", GC.CollectionCount(2).ToString()); }