fix: add color for error inside of log message (#6493)

This commit is contained in:
DmitriyLewen
2024-04-15 17:13:54 +06:00
committed by GitHub
parent dfcb0f90db
commit cfddfb33c1

View File

@@ -129,7 +129,7 @@ func (h *ColorHandler) appendAttr(buf []byte, a slog.Attr, groups []string) []by
buf = append(buf, key...)
buf = append(buf, '=')
if err, ok := a.Value.Any().(error); ok {
buf = strconv.AppendQuote(buf, color.HiRedString(err.Error()))
buf = append(buf, color.HiRedString(strconv.Quote(err.Error()))...)
} else {
buf = append(buf, a.Value.String()...)
}