// GetLevel get the log level string.
500874
func GetLevel() string {
	if l, ok := instance.(*log.Logger); ok {
		return l.GetLevel()
	}
	return "UNKNOWN"
}
492521
func CheckLogLevel(level string) error {
	if !flogging.IsValidLevel(level) {
		return errors.Errorf("invalid log level provided - %s", level)
	}
	return nil
}
410416
func (b *BatteryDriver) GetBatteryLevel() (level uint8) {
	var l uint8
	c, _ := b.adaptor().ReadCharacteristic("2a19")
	buf := bytes.NewBuffer(c)
	val, _ := buf.ReadByte()
	l = uint8(val)
	return l
}
594389
func (l *Logger) SetLevel(v string) {
	switch v {
	case "debug", "DEBUG":
		l.Level = logrus.DebugLevel
	case "info", "INFO":
		l.Level = logrus.InfoLevel
	case "warning", "WARNING":
		l.Level = logrus.WarnLevel
	case "error", "ERROR":
		l.Level = logrus.ErrorLevel
	case "fatal", "FATAL":
		l.Level = logrus.FatalLevel
	case "panic", "PANIC":
		l.Level = logrus.PanicLevel
	}
}
810446
func getColorLevel(level string) string {
	level = strings.ToUpper(level)
	switch level {
	case "TRAC":
		return fmt.Sprintf("\033[%dm%s\033[0m", Blue, level)
	case "ERRO":
		return fmt.Sprintf("\033[%dm%s\033[0m", Red, level)
	case "WARN":
		return fmt.Sprintf("\033[%dm%s\033[0m", Magenta, level)
	case "SUCC":
		return fmt.Sprintf("\033[%dm%s\033[0m", Green, level)
	default:
		return level
	}
}
1182090
func (logger *Logger) GetStackMinLevel() event.Level {
	return event.Level(atomic.LoadInt32(&logger.stackMinLevel))
}
1098006
func (lc *logConfig) getLevelByName(levelName string) (idx Level) {
	levelName = strings.Trim(strings.ToLower(levelName), " ")
	idx, ok := lc.levelMap[levelName]
	if !ok {
		idx = -1
	}
	return idx
}
692295
func (l *ConsoleLogger) Level(o int) {
	if o >= 0 && o <= len(l.levels)-1 {
		l.outLevel = o
	}
}
1229807
func (l *Logger) logWithLevel(logLvl LogLevel, data map[string]interface{}) {
	if logLvl < l.logLvl {
		// No log output
		return
	}
	data["level"] = logLvl.String()
	l.globalsL.RLock()
	defer l.globalsL.RUnlock()
	for key, value := range l.globals {
		if _, ok := data[key]; ok {
			// Values in the data map override the globals
			continue
		}
		data[key] = value
	}
	if l.logRouter != nil {
		data["_kvmeta"] = l.logRouter.Route(data)
	} else if globalRouter != nil {
		data["_kvmeta"] = globalRouter.Route(data)
	}

	l.fLogger.formatAndLog(data)
}
603715
func (l *Logger) SetLevel(level int) {
	if l.parent != nil {
		l.parent.SetLevel(level)
		return
	}
	l.mu.Lock()
	defer l.mu.Unlock()
	if level < int(logLevelDebug) {
		level = int(logLevelDebug)
	} else if level > int(logLevelWarning) {
		level = int(logLevelWarning)
	}
	l.level = logLevel(level)
}
375408
func LevelThreshold(l logrus.Level) []logrus.Level {
	for i := range AllLevels {
		if AllLevels[i] == l {
			return AllLevels[i:]
		}
	}
	return []logrus.Level{}
}
817409
func (l *LoggerLevels) Level(loggerName string) zapcore.Level {
	if level, ok := l.cachedLevel(loggerName); ok {
		return level
	}

	l.mutex.Lock()
	level := l.calculateLevel(loggerName)
	l.levelCache[loggerName] = level
	l.mutex.Unlock()

	return level
}
585692
func LogLevel(logType string) string {
	if _, ok := data.LogLevels[logType]; ok {
		return getRandValue([]string{"log_level", logType})
	}

	return getRandValue([]string{"log_level", "general"})
}
1108461
func (l *Logger) SetLevel(level Level) *Logger {
	l.mu.Lock()
	defer l.mu.Unlock()
	if level > DebugLevel {
		panic(gear.Err.WithMsg("invalid logger level"))
	}
	l.l = level
	return l
}
513823
func (l *Logger) Level(args ...interface{}) interface{} {
	if len(args) == 0 {
		// implements log.Level() -> LOG_LEVEL
		lowestLevel := LogLevelInfo
		for _, stream := range l.streams {
			if toLogLevelInt(stream.Level) < toLogLevelInt(lowestLevel) {
				lowestLevel = strings.ToLower(stream.Level)
			}
		}
		return lowestLevel
	} else if typeName(args[0]) == "string" && toLogLevelInt(args[0].(string)) > 0 {
		// implements log.Level(LOG_LEVEL)
		for _, stream := range l.streams {
			stream.Level = strings.ToLower(args[0].(string))
		}
	}
	return nil
}
216273
func LogLevel(level string) (Level, error) {
	l, err := metadata.ParseLevel(level)
	return Level(l), err
}
1343470
func GetLogLevel(ctx context.Context) (log.Level, bool) {
	if logCtx, ok := ctx.(*lsc); ok {
		return logCtx.logger.Level, true
	}
	return 0, false
}