Exemplo n.º 1
0
        static void Main(string[] args)
        {
            SpinUpSerilog();
            var logger = LoggerManager.Get <Program, IDemoLogger>(DemoLogResource.ResourceManager);

            logger.Test();
        }
Exemplo n.º 2
0
        public void Logs()
        {
            var sink      = new TestSimpleSink();
            var mahLogger = LoggerManager.Get <IBasicsLog>(sink);

            mahLogger.Message();

            Assert.True(sink.HasMessage(nameof(IBasicsLog.Message)));
        }
Exemplo n.º 3
0
        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());
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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());
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        public void Creates()
        {
            var mahLogger = LoggerManager.Get <IBasicsLog>();

            Assert.NotNull(mahLogger);
        }