MCPcopy Index your code
hub / github.com/coder/slog / Fmt

Function Fmt

internal/entryhuman/entry.go:198–200  ·  view source on GitHub ↗

Fmt returns a human readable format for ent. Assumes we have a bytes.Buffer which we will more easily be able to assume underlying reallocation of it's size is possible if necessary than for an arbitrary io.Writer/io.StringWriter Note that while bytes.Buffer can in theory return an error for writes,

(buf *bytes.Buffer, termW io.Writer, ent slog.SinkEntry)

Source from the content-addressed store, hash-verified

196// for extra lines in a log so if we did it here, the fields would be indented
197// twice in test logs. So the Stderr logger indents all the fields itself.
198func Fmt(buf *bytes.Buffer, termW io.Writer, ent slog.SinkEntry) {
199 Formatter{}.Fmt(buf, termW, ent)
200}
201
202func (f Formatter) Fmt(buf *bytes.Buffer, termW io.Writer, ent slog.SinkEntry) {
203 reset(buf, termW)

Callers 5

BenchmarkFmtFunction · 0.92
LogEntryMethod · 0.92
TestEntryFunction · 0.92
BenchmarkFmtFunction · 0.92

Calls 1

FmtMethod · 0.80

Tested by 4

BenchmarkFmtFunction · 0.74
TestEntryFunction · 0.74
BenchmarkFmtFunction · 0.74