MCPcopy Index your code
hub / github.com/tuna/tunasync / TestLineHandlerSystemdFormat

Function TestLineHandlerSystemdFormat

internal/logger_test.go:228–246  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

226}
227
228func TestLineHandlerSystemdFormat(t *testing.T) {
229 var buf bytes.Buffer
230 handler := newLineHandler(&buf, slog.LevelDebug, false, true)
231
232 record := slog.NewRecord(
233 time.Date(2024, time.January, 2, 3, 4, 5, 0, time.UTC),
234 slog.LevelWarn,
235 "systemd",
236 0,
237 )
238 if err := handler.Handle(context.Background(), record); err != nil {
239 t.Fatalf("Handle returned error: %v", err)
240 }
241
242 out := buf.String()
243 if got, want := out, "[WARN] systemd\n"; got != want {
244 t.Fatalf("systemd output = %q, want %q", got, want)
245 }
246}
247
248func TestLoggerHelpers(t *testing.T) {
249 if got := normalizeArgs(); got != "" {

Callers

nothing calls this directly

Calls 3

newLineHandlerFunction · 0.85
HandleMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected