Custom enrichers
An enricher runs on every emitted event before it reaches drains. It's the right tool when you want a field on every event without touching every call site — geo, user agent, trace context, deploy id, tenant id…
Canonical guide
Full reference at Custom enrichers:
defineEnricher()API- Reading request headers
- Async enrichers
- Combining built-in + custom
This page exists in the build-on-top section as a pointer — same content, classified by axis.
When to reach for plugins instead
If your feature mixes enrichment with other hooks (e.g. enrich + tail-sample + side-effect on drain), use a plugin instead — one cohesive object covering several lifecycle points.
Going further
Want to share an enricher across projects? See Enrichers as packages.
Plugins
definePlugin is the canonical extension contract for evlog. One plugin can opt into any subset of lifecycle hooks — enrich, drain, tail sampling, request lifecycle, client log observation.
Tail sampling
Decide post-hoc whether to keep an event based on the request outcome — keep all errors, keep slow requests, keep specific paths, drop the rest.