FormatLogfmtValue should escape error and fmt.Stringer values

This commit is contained in:
Jared Wasinger 2023-11-15 16:34:50 +08:00
parent 3b7e759215
commit cdde508ef1

View file

@ -169,9 +169,9 @@ func FormatLogfmtValue(value interface{}, term bool) (result string) {
}
switch v := value.(type) {
case error:
return v.Error()
return escapeString(v.Error())
case fmt.Stringer:
return v.String()
return escapeString(v.String())
case bool:
return strconv.FormatBool(v)
case float32: