// LevelFromString returns a Level type for the named log level, or "NoLevel" if
// the level string is invalid. This facilitates setting the log level via
// config or environment variable by name in a predictable way.
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
	}
}
888823
func (l Level) String() string {
	if name, ok := LevelNames[l]; ok {
		return name
	}
	return "Unknown"
}
817426
func (u *Unit) ValueFromString(str string) (*Value, error) {
	s := &Value{unit: u}

	if err := s.Set(str); err != nil {
		return nil, err
	}
	return s, nil
}
523042
func CheckLevel(level string) error {
	if _, err := log.ParseLevel(level); err != nil {
		return fmt.Errorf(`log level not valid: "%s"`, level)
	}
	return nil
}
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
}
282150
func (config *Config) LogLevel() int {
	if config.ENV.CFLogLevel != "" {
		envVal, err := strconv.ParseInt(config.ENV.CFLogLevel, 10, 32)
		if err == nil {
			return int(envVal)
		}

		switch strings.ToLower(config.ENV.CFLogLevel) {
		case "fatal":
			return 1
		case "error":
			return 2
		case "warn":
			return 3
		case "info":
			return 4
		case "debug":
			return 5
		}
	}

	return 0
}
463082
func (r DynamicRender) AddFromString(name, templateString string) *template.Template {
	builder := &templateBuilder{templateName: name, templateString: templateString}
	builder.buildType = stringTemplateType
	r[name] = builder
	return builder.buildTemplate()
}
1100613
func (v *Variable) TypeString() string {
	if v == nilVariable {
		return "nil"
	}
	if v.DwarfType != nil {
		return v.DwarfType.Common().Name
	}
	return v.Kind.String()
}
200999
func LogLevel(levelString string) (LoggingLevel, error) {
	l, err := logging.LogLevel(levelString)
	level := LoggingLevel(l)
	if err != nil {
		level = LogError
	}
	return level, err
}
669367
func (view *View) RenderFromString(loaderName string, tplSrc string, data map[string]interface{}) (string, error) {
	var buf bytes.Buffer
	// If loaderName is not indicated, use the default template library of Go, no syntax like
	// `extends` or `include` will be supported.
	if loaderName == "" {
		tmpl := template.New("error")
		tmpl.Parse(tplSrc)
		e := tmpl.Execute(&buf, data)
		return buf.String(), e
	}
	loader, ok := view.templateLoader[loaderName]
	if !ok {
		panic(Errorf("Template loader not fount: %s", loaderName))
	}
	e := loader.Render(&buf, tplSrc, data)
	if e != nil {
		return "", e
	}
	return buf.String(), nil
}
387254
func LevelFromString(lvl string) level {
	// Determine if lvl includes "level"
	lvl = strings.ToLower(lvl)
	if len(lvl) > 4 && lvl[0:5] != "level" {
		lvl = "level_" + lvl
	} else if len(lvl) < 5 {
		lvl = "level_" + lvl
	}
	for num, llvl := range levels {
		if lvl == strings.ToLower(llvl) {
			return level(num)
		}
	}
	return LEVEL_PRINT
}
798900
func VolumeFromString(vp string) (*Volume, error) {
	vp = "name=" + vp
	vpQuery, err := common.MakeQueryString(vp)
	if err != nil {
		return nil, err
	}

	v, err := url.ParseQuery(vpQuery)
	if err != nil {
		return nil, err
	}
	return VolumeFromParams(v)
}
171164
func MaybeFromString(str string) UUID {
	u, err := FromString(str)
	if err != nil {
		return zero
	}

	return u
}
1359431
func filesFromString(in string) ([]*proxy.FileDescriptor, error) {
	var out []fileDescriptor
	if err := json.Unmarshal([]byte(in), &out); err != nil {
		return nil, err
	}
	files := make([]*proxy.FileDescriptor, len(out))
	for i, o := range out {
		files[i] = &proxy.FileDescriptor{
			File:    os.NewFile(uintptr(o.FileFD), o.FileName),
			Address: o.Address,
		}
	}
	return files, nil
}
445876
func (p Property) TypeString() string {
	switch p.Type.(type) {
	case string:
		return p.Type.(string)
	case Type:
		if p._type == nil {
			panic(fmt.Errorf("property '%v' has no parent type", p.Name))
		}
		return p._type.Name + p.Name
	default:
		return "string"
	}
}
840466
func (k *PGPKeyBundle) DecryptFromString(ciphertext string) (msg []byte, sender keybase1.KID, err error) {
	err = KeyCannotDecryptError{}
	return
}
1127649
func (l LogLevel) String() string {
	switch l.Match() {
	case Critical:
		return "CRIT"
	case Error:
		return "ERR"
	case Warning:
		return "WARN"
	case Notice:
		return "NOTE"
	case Info:
		return "INFO"
	case Debug:
		return "DEBUG"
	case Trace:
		return "TRACE"
	default:
		return "UNSET"
	}
}