李度、马也驰 25spring数据库系统 p1仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

24 lines
545 B

package logprovider
import "fmt"
const (
JsonLogFormat = "json"
ConsoleLogFormat = "console"
)
var DefaultLogFormat = JsonLogFormat
// ConvertToZapFormat converts and validated logprovider format string.
func ConvertToZapFormat(format string) (string, error) {
switch format {
case ConsoleLogFormat:
return ConsoleLogFormat, nil
case JsonLogFormat:
return JsonLogFormat, nil
case "":
return DefaultLogFormat, nil
default:
return "", fmt.Errorf("unknown logprovider format: %s, supported values json, console", format)
}
}