Exemple #1
0
        static LogLog()
        {
            try {
                var level =
                    Environment.GetEnvironmentVariable("FF_LOGLOG_LEVEL") ?? string.Empty;
                level = level.Trim();

                LoggerLevel myLevel;
                if (level.Length == 0)
                {
                    // nop
                }
                else if (LoggerLevel.TryParse(level, out myLevel))
                {
                    WriteCore(LoggerLevel.Info,
                              LogErrorCode.InfoChangedLogLevel,
                              "Set log level: " + myLevel);
                    Levels = LoggerLevels.Above(myLevel);
                }
                else
                {
                    WriteCore(LoggerLevel.Warn,
                              LogErrorCode.InfoUnrecognizedLogLevel,
                              "Unrecognized log level: " + myLevel);
                }
            } catch (PlatformNotSupportedException) {
            } catch (SecurityException) {
            }
        }
 public void test_above_range_contains()
 {
     Assert.True(LoggerLevels.Above(LoggerLevel.Error).IsMatch(LoggerLevel.Error));
     Assert.True(LoggerLevels.Above(LoggerLevel.Error).IsMatch(LoggerLevel.Fatal));
     Assert.False(LoggerLevels.Above(LoggerLevel.Error).IsMatch(LoggerLevel.Warn));
 }
 public void test_parse_range_unbounded_above()
 {
     Assert.Equal(LoggerLevels.Above(LoggerLevel.Error), LoggerLevels.Parse("Error:"));
 }