package log

import (
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
)

var logLevelMap = map[string]zapcore.Level{
	"panic": zap.DPanicLevel,
	"fatal": zap.FatalLevel,
	"error": zap.ErrorLevel,
	"warn":  zap.WarnLevel,
	"info":  zap.InfoLevel,
	"debug": zap.DebugLevel,
}

// GetLogLevel get the logLevel from logLevelName
func GetLogLevel(logLevelName string) zapcore.Level {
	if v, ok := logLevelMap[logLevelName]; ok {
		return v
	}
	return zap.DebugLevel
}
