public void ForContext_with_non_null_argument_should_produce_a_wrapper_around_named_logger()
        {
            adapter = adapter.ForContext("CustomLogger");

            adapter.Info("Hello!");

            ObservedEvent.LoggerName.Should().Be("CustomLogger");
        }
Example #2
0
        public void ForContext_should_preserve_configured_logger_name_factory()
        {
            ((Log4netLog)adapter).LoggerNameFactory = ctx => string.Join(".", ctx.Reverse());

            adapter = adapter
                .ForContext("ctx1")
                .ForContext("ctx2")
                .ForContext("ctx3");

            adapter.Info("Hello!");

            ObservedEvent.LoggerName.Should().Be("ctx3.ctx2.ctx1");
        }