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

Function TestSlogHandler_WithDurationAttr

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

Source from the content-addressed store, hash-verified

155}
156
157func TestSlogHandler_WithDurationAttr(t *testing.T) {
158 var buf bytes.Buffer
159 logger := newSlogLogger(&buf)
160
161 logger.Info("test", slog.Duration("elapsed", 5*time.Second))
162
163 m := decodeJSON(t, &buf)
164 if m["elapsed"] == nil {
165 t.Error("expected elapsed field to be present")
166 }
167}
168
169func TestSlogHandler_WithErrorAttr(t *testing.T) {
170 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 4

newSlogLoggerFunction · 0.85
decodeJSONFunction · 0.85
InfoMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected