(b *testing.B)
| 349 | } |
| 350 | |
| 351 | func BenchmarkDataRace(b *testing.B) { |
| 352 | log := zerolog.New(nil).With(). |
| 353 | Str("foo", "bar"). |
| 354 | Logger() |
| 355 | lh := NewHandler(log) |
| 356 | h := lh(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 357 | l := FromRequest(r) |
| 358 | l.UpdateContext(func(c zerolog.Context) zerolog.Context { |
| 359 | return c.Str("bar", "baz") |
| 360 | }) |
| 361 | l.Log().Msg("") |
| 362 | })) |
| 363 | |
| 364 | b.RunParallel(func(pb *testing.PB) { |
| 365 | for pb.Next() { |
| 366 | h.ServeHTTP(nil, &http.Request{}) |
| 367 | } |
| 368 | }) |
| 369 | } |
| 370 | |
| 371 | func TestCtxWithID(t *testing.T) { |
| 372 | ctx := context.Background() |
nothing calls this directly
no test coverage detected