Handle empty log-format gracefully
parent
ec252d06c9
commit
3c6e09f932
|
@ -29,6 +29,8 @@ func ConvertToZapFormat(format string) (string, error) {
|
|||
case ConsoleLogFormat:
|
||||
return ConsoleLogFormat, nil
|
||||
case JsonLogFormat:
|
||||
return JsonLogFormat, nil
|
||||
case "":
|
||||
return DefaultLogFormat, nil
|
||||
default:
|
||||
return "", fmt.Errorf("unknown log format: %s, supported values json, console", format)
|
||||
|
|
|
@ -26,7 +26,8 @@ func TestLogFormat(t *testing.T) {
|
|||
}{
|
||||
{"json", JsonLogFormat, false},
|
||||
{"console", ConsoleLogFormat, false},
|
||||
{"", "", true},
|
||||
{"", JsonLogFormat, false},
|
||||
{"konsole", "", true},
|
||||
}
|
||||
|
||||
for i, tt := range tests {
|
||||
|
|
Loading…
Reference in New Issue