MCPcopy
hub / github.com/rs/zerolog / TestSlogHandler_WithErrorAttr

Function TestSlogHandler_WithErrorAttr

slog_test.go:169–179  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

167}
168
169func TestSlogHandler_WithErrorAttr(t *testing.T) {
170 var buf bytes.Buffer
171 logger := newSlogLogger(&buf)
172
173 logger.Info("test", slog.Any("err", errors.New("something failed")))
174
175 m := decodeJSON(t, &buf)
176 if m["err"] != "something failed" {
177 t.Errorf("expected err='something failed', got %v", m["err"])
178 }
179}
180
181func TestSlogHandler_WithAttrs(t *testing.T) {
182 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 4

newSlogLoggerFunction · 0.85
decodeJSONFunction · 0.85
InfoMethod · 0.65
AnyMethod · 0.45

Tested by

no test coverage detected