mirror of
https://github.com/mjl-/mox.git
synced 2025-06-28 01:48:15 +03:00
for trace-level logging in console format (as opposed to logfmt), print the trace as quoted string
so we can easily see the exact bytes on the wire, instead of having \n's expanded as newlines. much easier to read. we had this in the past, but it must have been lost in a refactor.
This commit is contained in:
parent
95d2002e77
commit
3f6c45a41f
@ -575,7 +575,11 @@ func (h *handler) write(l slog.Level, r slog.Record) error {
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Fprint(eb, LevelStrings[r.Level], ": ", r.Message)
|
||||
msg := r.Message
|
||||
if r.Level <= LevelTrace {
|
||||
msg = fmt.Sprintf("%q", msg)
|
||||
}
|
||||
fmt.Fprint(eb, LevelStrings[r.Level], ": ", msg)
|
||||
n := 0
|
||||
r.Attrs(func(a slog.Attr) bool {
|
||||
if n == 0 && a.Key == "err" && h.Group == "" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user