Exemplo n.º 1
0
        public void Can_Create_Logger_And_Append_Provider_() {
            ILoggerFactory factory = new LoggerFactory();

            var provicer1 = new ConsoleLoggerProvider(LogLevel.Error);

            factory.AddProvider(provicer1);

            var logger = factory.CreateLogger<LoggerTest>();

            Assert.False(logger.IsEnabled(LogLevel.Debug));

            var provicer2 = new ConsoleLoggerProvider(LogLevel.Debug);

            //append provider
            factory.AddProvider(provicer2);

            Assert.True(logger.IsEnabled(LogLevel.Debug));
        }
Exemplo n.º 2
0
        public void Can_AddProvider_Create_Logger() {
            ILoggerFactory factory = new LoggerFactory();

            var provicer1 = new ConsoleLoggerProvider(LogLevel.Error);
            var provicer2 = new ConsoleLoggerProvider(LogLevel.Debug);

            factory.AddProvider(new[] { provicer1, provicer2 });

            var logger = factory.CreateLogger(this.GetType().Name);

            Assert.True(logger.IsEnabled(LogLevel.Debug));
        }