static void Main(string[] args) { SpinUpSerilog(); var logger = LoggerManager.Get <Program, IDemoLogger>(DemoLogResource.ResourceManager); logger.Test(); }
public void Logs() { var sink = new TestSimpleSink(); var mahLogger = LoggerManager.Get <IBasicsLog>(sink); mahLogger.Message(); Assert.True(sink.HasMessage(nameof(IBasicsLog.Message))); }
public void ResxWorks() { var sink = new TestSimpleSink(); var logger = LoggerManager.Get <IBasicsLog> (sink, ResXLogSource.FromManager(Resources.ResourceManager)); logger.Message(); Assert.Equal(Resources.Message, sink.FirstMessage()); }
public void ResXUsesLevel() { var sink = new TestComplexSink(); var logger = LoggerManager.Get <IBasicsLog> (sink, ResXLogSource.FromManager(Resources.ResourceManager)); logger.MessageWithPriority(); Assert.Equal(Resources.MessageWithPriority, sink.FirstMessage.Text); Assert.Equal(LogLevel.Fatal, sink.FirstMessage.Level); }
public void ConfigurableText() { var sink = new TestSimpleSink(); var realmessage = "The real messsage"; var messageSource = new TestSimpleMessageSource() .MessageText(nameof(IBasicsLog.Message), realmessage); var mahLogger = LoggerManager.Get <IBasicsLog>(sink, messageSource); mahLogger.Message(); Assert.True(sink.HasMessage(realmessage)); }
public void ParametrizationBooBoo() { var sink = new TestSimpleSink(); var msg = "Message {999}"; var messageSource = new TestSimpleMessageSource() .MessageText(nameof(IBasicsLog.ParametrizedMessage), msg); var testLogger = LoggerManager.Get <IBasicsLog>(sink, messageSource); testLogger.ParametrizedMessage(123); Assert.Equal(msg, sink.FirstMessage()); }
public void Priority() { var sink = new TestComplexSink(); var expectedMessage = "priority test message"; var expectedLevel = LogLevel.Fatal; var messageSource = new TestSimpleMessageSource() .MessageText(nameof(IBasicsLog.ParametrizedMessage), expectedMessage, expectedLevel); var testLogger = LoggerManager.Get <IBasicsLog>(sink, messageSource); testLogger.ParametrizedMessage(123); Assert.Equal(expectedMessage, sink.FirstMessage.Text); Assert.Equal(expectedLevel, sink.FirstMessage.Level); }
public void Creates() { var mahLogger = LoggerManager.Get <IBasicsLog>(); Assert.NotNull(mahLogger); }