Use everywhere InterfaceMarshalFunc (#414)

This commit is contained in:
Mitar 2022-07-16 13:03:29 -07:00 committed by GitHub
parent b30730fab2
commit dbdec88d16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -222,7 +222,7 @@ func (w ConsoleWriter) writeFields(evt map[string]interface{}, buf *bytes.Buffer
case json.Number: case json.Number:
buf.WriteString(fv(fValue)) buf.WriteString(fv(fValue))
default: default:
b, err := json.Marshal(fValue) b, err := InterfaceMarshalFunc(fValue)
if err != nil { if err != nil {
fmt.Fprintf(buf, colorize("[error: %v]", colorRed, w.NoColor), err) fmt.Fprintf(buf, colorize("[error: %v]", colorRed, w.NoColor), err)
} else { } else {

View File

@ -102,7 +102,7 @@ func (w journalWriter) Write(p []byte) (n int, err error) {
case json.Number: case json.Number:
args[jKey] = fmt.Sprint(value) args[jKey] = fmt.Sprint(value)
default: default:
b, err := json.Marshal(value) b, err := zerolog.InterfaceMarshalFunc(value)
if err != nil { if err != nil {
args[jKey] = fmt.Sprintf("[error: %v]", err) args[jKey] = fmt.Sprintf("[error: %v]", err)
} else { } else {