log.go 633 字节
package utils

import "github.com/astaxie/beego"

func init() {
	logLevelMap := make(map[string]int)
	logLevelMap["debug"] = beego.LevelDebug
	logLevelMap["info"] = beego.LevelInformational
	logLevelMap["warn"] = beego.LevelWarning
	logLevelMap["error"] = beego.LevelError
	logLevelMap["fatal"] = beego.LevelEmergency
}

func ResolveLogLevel(level string) int {
	switch level {
	case "debug":
		return beego.LevelDebug
	case "info":
		return beego.LevelInformational
	case "warn":
		return beego.LevelWarning
	case "error":
		return beego.LevelError
	case "fatal":
		return beego.LevelEmergency
	}
	return beego.LevelInformational
}