(t *testing.T)
| 337 | } |
| 338 | |
| 339 | func TestSlogHandler_MultipleAttrs(t *testing.T) { |
| 340 | var buf bytes.Buffer |
| 341 | logger := newSlogLogger(&buf) |
| 342 | |
| 343 | logger.Info("multi", |
| 344 | slog.String("a", "1"), |
| 345 | slog.Int("b", 2), |
| 346 | slog.Bool("c", true), |
| 347 | slog.Float64("d", 3.5), |
| 348 | ) |
| 349 | |
| 350 | m := decodeJSON(t, &buf) |
| 351 | if m["a"] != "1" { |
| 352 | t.Errorf("expected a=1, got %v", m["a"]) |
| 353 | } |
| 354 | if m["b"] != float64(2) { |
| 355 | t.Errorf("expected b=2, got %v", m["b"]) |
| 356 | } |
| 357 | if m["c"] != true { |
| 358 | t.Errorf("expected c=true, got %v", m["c"]) |
| 359 | } |
| 360 | if m["d"] != 3.5 { |
| 361 | t.Errorf("expected d=3.5, got %v", m["d"]) |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | func TestSlogHandler_LogValuer(t *testing.T) { |
| 366 | var buf bytes.Buffer |
nothing calls this directly
no test coverage detected