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

Function TestStdlib

s_test.go:13–27  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestStdlib(t *testing.T) {
14 t.Parallel()
15
16 b := &bytes.Buffer{}
17 l := slog.Make(sloghuman.Sink(b)).With(
18 slog.F("hi", "we"),
19 )
20 stdlibLog := slog.Stdlib(bg, l, slog.LevelInfo)
21 stdlibLog.Println("stdlib")
22
23 et, rest, err := entryhuman.StripTimestamp(b.String())
24 assert.Success(t, "strip timestamp", err)
25 assert.False(t, "timestamp", et.IsZero())
26 assert.Equal(t, "entry", " [info] stdlib: stdlib hi=we\n", rest)
27}

Callers

nothing calls this directly

Calls 7

SinkFunction · 0.92
StripTimestampFunction · 0.92
SuccessFunction · 0.92
FalseFunction · 0.92
EqualFunction · 0.92
WithMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected