Skip to content

Commit 1bc4719

Browse files
committed
log: lots of optimizations to terminal output
- implement custom time writer, - better padding with spaces - better use of spaces - log: more efficient handling of slog.Value - log: utilize scratch-buffer in terminal handler - log: use scratch-space for value formatting
1 parent 0c8b6ca commit 1bc4719

File tree

4 files changed

+180
-135
lines changed

4 files changed

+180
-135
lines changed

internal/testlog/testlog.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ func (h *bufHandler) terminalFormat(r slog.Record) string {
183183
}
184184

185185
for _, attr := range attrs {
186-
rawVal := attr.Value.Any()
187-
fmt.Fprintf(buf, " %s=%s", attr.Key, log.FormatLogfmtValue(rawVal, true))
186+
fmt.Fprintf(buf, " %s=%s", attr.Key, string(log.FormatSlogValue(attr.Value, true, nil)))
188187
}
189188
buf.WriteByte('\n')
190189
return buf.String()

0 commit comments

Comments
 (0)