コード例 #1
0
        public void ProcessRoutableWithinAllowedAndBlockedLoglevels_ShouldReturn_EmptyList()
        {
            var filter   = new LoglevelFilter <StandardLoglevel>(new StandardLoglevel[] { StandardLoglevel.Information }, new StandardLoglevel[] { StandardLoglevel.Information });
            var logEvent = new LogEvent <StandardLoglevel>((_logEvent) => { }, StandardLoglevel.Information);

            filter.Process(logEvent).Should().BeEmpty();
        }
コード例 #2
0
        public void ProcessForcedRoutableWithLoglevelOutOfRange_ShouldReturn_Null()
        {
            var filter   = new LoglevelFilter <StandardLoglevel>(new StandardLoglevel[0], new StandardLoglevel[] { StandardLoglevel.Trace });
            var logEvent = new LogEvent <StandardLoglevel>((_logEvent) => { }, StandardLoglevel.Trace).Force;

            filter.Process(logEvent).Should().BeNull();
        }
コード例 #3
0
        public void ProcessRoutableWithNoLoglevelsConfigured_ShouldReturn_Null()
        {
            var filter   = new LoglevelFilter <StandardLoglevel>(new StandardLoglevel[0], new StandardLoglevel[0]);
            var logEvent = new LogEvent <StandardLoglevel>((_logEvent) => { }, StandardLoglevel.Information);

            filter.Process(logEvent).Should().BeNull();
        }
コード例 #4
0
        public void ProcessBlockedLogLevel_ShouldReturn_EmptyList()
        {
            var filter   = new LoglevelFilter <StandardLoglevel>(new StandardLoglevel[0], new StandardLoglevel[] { StandardLoglevel.Information });
            var logEvent = new LogEvent <StandardLoglevel>((_logEvent) => { }, StandardLoglevel.Information);

            filter.Process(logEvent).Should().BeEmpty();
        }
コード例 #5
0
        public void ProcessAllowedLoglevel_ShouldReturn_Null()
        {
            var filter   = new LoglevelFilter <StandardLoglevel>(new StandardLoglevel[] { StandardLoglevel.Information }, new StandardLoglevel[0]);
            var logEvent = new LogEvent <StandardLoglevel>((_logEvent) => { }, StandardLoglevel.Information);

            filter.Process(logEvent).Should().BeNull();
        }
コード例 #6
0
        public void Constructor_Should_SetProperties()
        {
            var allowed = new StandardLoglevel[] { StandardLoglevel.Information };
            var blocked = new StandardLoglevel[] { StandardLoglevel.Warning };
            var filter  = new LoglevelFilter <StandardLoglevel>(allowed, blocked);

            filter.AllowLoglevels.Should().Contain(StandardLoglevel.Information);
            filter.BlockLoglevels.Should().Contain(StandardLoglevel.Warning);
        }
コード例 #7
0
        /// <summary>
        /// Builds a new instance of the <see cref="LogfileConfiguration{TLoglevel}"/>
        /// based on the settings within this builder instance.
        /// </summary>
        /// <returns>The logfile configuration.</returns>
        ///	<exception cref="ArgumentOutOfRangeException">Thrown if the property
        ///		<c>MaximumRoutablesQueueLength</c> is less than or equal to
        ///		zero, the property <c>maximumRoutablesForwardingCount</c> is less than
        ///		or equal to zero, or the property <c>waitForMoreRoutablesForwardingDelay"</c>
        ///		is less than zero.</exception>
        public LogfileConfiguration <TLoglevel> Build()
        {
            var loglevelFilter = new LoglevelFilter <TLoglevel>(this.AllowLoglevels, this.BlockLoglevels);

            return(new LogfileConfiguration <TLoglevel>(
                       this.Routers,
                       this.Preprocessors.Concat(new IRoutablePreprocessor <LogEvent <TLoglevel> >[] { loglevelFilter }),
                       this.MaximumRoutableQueueLength,
                       this.MaximumRoutablesForwardingCount,
                       this.WaitForMoreRoutablesForwardingDelay,
                       this.IsDeveloperModeEnabled));
        }