mirror of
https://github.com/mjl-/mox.git
synced 2025-07-13 03:34:39 +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:
@ -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 == "" {
|
||||
|
Reference in New Issue
Block a user