- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for newAsyncHandler (0.18 sec)
-
src/log/slog/internal/benchmarks/handlers_test.go
t.Fatal(err) } got := b.String() if got != wantText { t.Errorf("\ngot %q\nwant %q", got, wantText) } }) t.Run("async", func(t *testing.T) { h := newAsyncHandler() if err := h.Handle(ctx, r); err != nil { t.Fatal(err) } got := h.ringBuffer[0] if !got.Time.Equal(r.Time) || !slices.EqualFunc(attrSlice(got), attrSlice(r), slog.Attr.Equal) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Nov 17 23:34:11 UTC 2023 - 1.1K bytes - Viewed (0) -
src/log/slog/internal/benchmarks/benchmarks_test.go
ctx := context.Background() for _, handler := range []struct { name string h slog.Handler skipRace bool }{ {"disabled", disabledHandler{}, false}, {"async discard", newAsyncHandler(), true}, {"fastText discard", newFastTextHandler(io.Discard), false}, {"Text discard", slog.NewTextHandler(io.Discard, nil), false}, {"JSON discard", slog.NewJSONHandler(io.Discard, nil), false}, } {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 04 18:32:54 UTC 2023 - 4.5K bytes - Viewed (0) -
src/log/slog/internal/benchmarks/handlers.go
// arbitrary number of Records without either blocking or allocation. type asyncHandler struct { ringBuffer [100]slog.Record next int } func newAsyncHandler() *asyncHandler { return &asyncHandler{} } func (*asyncHandler) Enabled(context.Context, slog.Level) bool { return true } func (h *asyncHandler) Handle(_ context.Context, r slog.Record) error {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Apr 12 20:33:37 UTC 2023 - 4.1K bytes - Viewed (0)