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

Function TestSlogHandler_WithTimeAttr

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

Source from the content-addressed store, hash-verified

142}
143
144func TestSlogHandler_WithTimeAttr(t *testing.T) {
145 var buf bytes.Buffer
146 logger := newSlogLogger(&buf)
147
148 ts := time.Date(2024, 1, 15, 12, 0, 0, 0, time.UTC)
149 logger.Info("test", slog.Time("created", ts))
150
151 m := decodeJSON(t, &buf)
152 if m["created"] == nil {
153 t.Error("expected created field to be present")
154 }
155}
156
157func TestSlogHandler_WithDurationAttr(t *testing.T) {
158 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected