Skip to content

Commit

Permalink
feat: non-blocking log collection
Browse files Browse the repository at this point in the history
  • Loading branch information
samber committed Oct 25, 2023
1 parent f2422ce commit 93f377f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ func (h *WebhookHandler) Handle(ctx context.Context, record slog.Record) error {

payload := converter(h.option.AddSource, h.option.ReplaceAttr, h.attrs, h.groups, &record)

return send(h.option.Endpoint, payload)
go func() {
_ = send(h.option.Endpoint, payload)
}()

return nil
}

func (h *WebhookHandler) WithAttrs(attrs []slog.Attr) slog.Handler {
Expand Down

0 comments on commit 93f377f

Please sign in to comment.