public void IsEnabledFor_ReturnsValidResult(LogLevel minLevel, MsLogLevel level, bool expectedEnabled)
        {
            loggerProvider = new VostokLoggerProvider(log.WithMinimumLevel(minLevel));

            var logger = loggerProvider.CreateLogger(null);

            logger.IsEnabled(level).Should().Be(expectedEnabled);
        }
        public void IsEnabledFor_ReturnsValidResult(MsLogLevel minLevel, LogLevel level, bool expectedEnabled)
        {
            var provider            = new VostokLoggerProvider(oracleLog);
            var loggerFilterOptions = new LoggerFilterOptions {
                MinLevel = minLevel
            };
            var loggerFactory = new LoggerFactory(new[] { provider }, loggerFilterOptions);

            var microsoftLogger1 = loggerFactory.CreateLogger <MicrosoftLog_BasedOnPureLogger_Tests>();

            var microsoftLog1 = new MicrosoftLog(microsoftLogger1);

            microsoftLog1.IsEnabledFor(level).Should().Be(expectedEnabled);
        }
示例#3
0
        private static MicrosoftLogLevel ConvertLogLevel(VostokLogLevel logLevel)
        {
            switch (logLevel)
            {
            case VostokLogLevel.Debug:
                return(MicrosoftLogLevel.Debug);

            case VostokLogLevel.Info:
                return(MicrosoftLogLevel.Information);

            case VostokLogLevel.Warn:
                return(MicrosoftLogLevel.Warning);

            case VostokLogLevel.Error:
                return(MicrosoftLogLevel.Error);

            case VostokLogLevel.Fatal:
                return(MicrosoftLogLevel.Critical);

            default:
                return(MicrosoftLogLevel.None);
            }
        }
示例#4
0
 public bool IsEnabledFor(VostokLogLevel level) => true;
示例#5
0
        public bool IsEnabledFor(VostokLogLevel level)
        {
            var logLevel = ConvertLogLevel(level);

            return(logger.IsEnabled(logLevel));
        }
示例#6
0
        public bool IsEnabledFor(VostokLogLevel level)
        {
            var logLevel = TranslateLogLevel(level);

            return(IsEnabledFor(logLevel));
        }
 public bool IsEnabledFor(LogLevel level) => true;