log: make log level case insensitive (#407)

Signed-off-by: SpadeA-Tang <u6748471@anu.edu.au>
This commit is contained in:
Spade A 2022-07-06 17:41:23 +08:00 committed by GitHub
parent 28f12587cb
commit be014c2aee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@ import (
"log" "log"
"os" "os"
"runtime" "runtime"
"strings"
) )
const ( const (
@ -232,6 +233,7 @@ func (l *Logger) Infof(format string, v ...interface{}) {
} }
func StringToLogLevel(level string) LogLevel { func StringToLogLevel(level string) LogLevel {
level = strings.ToLower(level)
switch level { switch level {
case "fatal": case "fatal":
return LOG_LEVEL_FATAL return LOG_LEVEL_FATAL