// Allows to specify custom level names in form level.X=<levelName>
// for example: level.11=SEVERE
430440
func (lc *logConfig) applyLevelParams(params map[string]string) {
	levels := groupConfigParams(params, cfgLevel, nil)
	lvlMap, ok := levels[""]
	if ok {
		for levelNum, levelName := range lvlMap {
			level, err := strconv.Atoi(levelNum)
			if err != nil || level < 0 || level > int(ALL) {
				panic("Incorrect log level id=" + strconv.Itoa(level) +
					" provided with \"" + levelName + "\": the id should be in [0.." + strconv.Itoa(int(ALL)) + "]")
			}
			// need to remove previous name from lc.levelMap to avoid 2+ names refer to the same level number
			delete(lc.levelMap, strings.Trim(strings.ToLower(lc.levelNames[level]), " "))
			lc.levelNames[level] = levelName
		}
	}

	for i, _ := range lc.levelNames {
		levelName := strings.Trim(strings.ToLower(lc.levelNames[i]), " ")
		if len(levelName) > 0 {
			lc.levelMap[levelName] = Level(i)
		}
	}
}
16588
func LevelFromString(levelStr string) Level {
	// We don't care about case. Accept both "INFO" and "info".
	levelStr = strings.ToLower(strings.TrimSpace(levelStr))
	switch levelStr {
	case "trace":
		return Trace
	case "debug":
		return Debug
	case "info":
		return Info
	case "warn":
		return Warn
	case "error":
		return Error
	default:
		return NoLevel
	}
}
517660
func LevelChange(listener func(*vecty.Event)) *vecty.EventListener {
	return &vecty.EventListener{Name: "levelchange", Listener: listener}
}
742209
func HandlerLevelName(entry *logrus.Entry, formatter *CustomFormatter) (interface{}, error) {
	return Color(entry, formatter, strings.ToUpper(entry.Level.String())), nil
}
576628
func GetLevel(c context.Context) Level {
	if l, ok := c.Value(levelKey).(Level); ok {
		return l
	}
	return DefaultLevel
}
1068510
func ParseFilename(name string) (level, id int) {
	a := fileIDRegex.FindStringSubmatch(filepath.Base(name))
	if a == nil {
		return 0, 0
	}

	level, _ = strconv.Atoi(a[1])
	id, _ = strconv.Atoi(a[2])
	return id, level
}
543121
func (sh *Hook) Levels() []logrus.Level {
	lvls := make([]logrus.Level, 0, len(logrus.AllLevels))
	for _, l := range logrus.AllLevels {
		if sh.MinLevel >= l {
			lvls = append(lvls, l)
		}
	}

	return lvls
}
503889
func (c *xContext) Param(name string, defaults ...string) (value string) {
	l := len(c.pnames)
	for i, n := range c.pnames {
		if n == name && i < l {
			value = c.pvalues[i]
			break
		}
	}

	if len(value) == 0 && len(defaults) > 0 {
		return defaults[0]
	}
	return
}
1288716
func LevelFromString(str string) LevelType {
	level, ok := StringLevels[strings.ToUpper(str)]
	if !ok {
		return LevelType(-1)
	}
	return level
}
782929
func (p *SLSHook) Levels() []logrus.Level {
	if p.AcceptedLevels == nil {
		return allLevels
	}
	return p.AcceptedLevels
}
934377
func parseModelPrefixName(key string) (string, string, bool) {
	for _, prefix := range modelPrefixes {
		if strings.HasPrefix(key, prefix) {
			return prefix, key[len(prefix):], true
		}
	}
	return "", "", false
}
407740
func (r *Hook) Levels() []logrus.Level {
	if r.triggers == nil {
		return defaultTriggerLevels
	}
	return r.triggers
}
113561
func fieldName(x Expr) *Ident {
	switch t := x.(type) {
	case *Ident:
		return t
	case *SelectorExpr:
		if _, ok := t.X.(*Ident); ok {
			return t.Sel
		}
	case *StarExpr:
		return fieldName(t.X)
	}
	return nil
}
472144
func NameToLevel(level string) zapcore.Level {
	l, err := nameToLevel(level)
	if err != nil {
		return zapcore.InfoLevel
	}
	return l
}
577477
func (provider *Provider) IsEnabledForLevel(level Level) bool {
	return provider.IsEnabledForLevelAndKeywords(level, ^uint64(0))
}
134523
func (elk *UDPHook) Levels() []log.Level {
	return []log.Level{
		log.PanicLevel,
		log.FatalLevel,
		log.ErrorLevel,
		log.WarnLevel,
		log.InfoLevel,
		log.DebugLevel,
	}
}
1298678
func SetLevelFromName(level string) error {
	l := StringToLevel[strings.ToUpper(level)]
	if l > 0 {
		SetLevel(l)
	} else {
		return fmt.Errorf("invalid log level: %q", level)
	}
	return nil
}