private void Log(LogLevel level, string message, Exception ex) { //NOTE: the logger is not thread safe, so we create it each time ILogger logger = new NullLogger();//TODO: Create logger eventually logger.Log(level, message, ex); }
public void NullLoggerTest() { const string message = "Test"; var logger = new NullLogger(); logger.Log(message); logger.Close(); // Just checking that it compiles }
public void Log_ShouldNotThrow_WhenExceptionIsNull_ForEachLogLevel(LogLevel logLevel) { // arrange var sut = new NullLogger(); // act Action act = () => sut.Log(new LogEntry(logLevel, "dummy")); // assert act.Should().NotThrow(); }
public void null_logger_does_nothing() { var obj = new object(); var ex = new Exception(); var msg = "Log Message"; var logger = new NullLogger(); logger.Log(new LogEvent()); logger.Debug(obj); logger.Debug(msg); logger.Debug(msg, ex); logger.Error(obj); logger.Error(msg); logger.Error(msg, ex); logger.Fatal(obj); logger.Fatal(msg); logger.Fatal(msg, ex); logger.Info(obj); logger.Info(msg); logger.Info(msg, ex); logger.Warn(obj); logger.Warn(msg); logger.Warn(msg, ex); logger.Trace(obj); logger.Trace(msg); logger.Trace(msg, ex); logger.Level.ShouldBe(LogLevel.Trace); }
public void NullLogger_Log_DoesNotThrow() { var logger = new NullLogger <RulesEngine>(); logger.Log(LogLevel.Critical, 1, "This is a critical message."); }
public void Log_Test() { var logger = new NullLogger(); logger.Log(() => new LogEntry(LoggingEventType.Debug, string.Empty)); }