예제 #1
0
        public SemanticLogAdapterTests()
        {
            channels.Add(channel.Object);

            channel.Setup(x => x.Log(It.IsAny <SemanticLogLevel>(), It.IsAny <string>())).Callback(
                new Action <SemanticLogLevel, string>((level, message) =>
            {
                output = message;
            }));

            log = new Lazy <SemanticLog>(() => new SemanticLog(channels, new List <ILogAppender>(), () => new JsonLogWriter()));

            sut = new SemanticLogLoggerProvider(log.Value);
        }
예제 #2
0
        public SemanticLogAdapterTests()
        {
            channels.Add(channel);

            A.CallTo(() => channel.Log(A <SemanticLogLevel> .Ignored, A <string> .Ignored))
            .Invokes((SemanticLogLevel level, string message) =>
            {
                output = message;
            });

            log = new Lazy <SemanticLog>(() => new SemanticLog(channels, new List <ILogAppender>(), () => new JsonLogWriter()));

            sut = new SemanticLogLoggerProvider(log.Value);
        }
예제 #3
0
        public SemanticLogAdapterTests()
        {
            options.Value.Level = SemanticLogLevel.Trace;

            channels.Add(channel);

            A.CallTo(() => channel.Log(A <SemanticLogLevel> ._, A <string> ._))
            .Invokes((SemanticLogLevel level, string message) =>
            {
                output = message;
            });

            log = new Lazy <SemanticLog>(() => new SemanticLog(options, channels, new List <ILogAppender>(), JsonLogWriterFactory.Default()));

            sut = SemanticLogLoggerProvider.ForTesting(log.Value);
        }
예제 #4
0
        public void Should_provide_null_logger_when_no_log_provided()
        {
            var provider = SemanticLogLoggerProvider.ForTesting(null);

            Assert.Same(provider.CreateLogger("test"), NullLogger.Instance);
        }