Use Cases
Use Cases are recipes, not features. Each one solves a specific problem with the same evlog primitives you already know — wide events, structured errors, drains, enrichers. They live as their own section because they have enough surface area (multiple pages each, dedicated examples) to deserve direct navigation, but they're not a separate runtime — same logger, same drain pipeline, same types.
| You want to… | See |
|---|---|
Send browser logs to your server with batching, retries, and sendBeacon fallback | Client Logging |
| Capture every AI SDK call with token usage, tool calls, streaming metrics, and cost | AI SDK |
| Identify the authenticated user (and their org / role) on every wide event | Better Auth |
| Build a tamper-evident audit trail with hash chains, denials, redaction-aware diffs | Audit Logs |
| Add derived context (User-Agent, geo, request size, trace context) to every event | Enrichers |
How they relate
your app code
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ evlog logger │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ ┌──────────────┐ │
│ │ Client logs │ │ AI SDK wrapper │ │ Audit logger │ │
│ │ (browser → API) │ │ (token / tools) │ │ (hash chain) │ │
│ └─────────────────┘ └─────────────────┘ └──────────────┘ │
│ │ │ │ │
│ └─────────────────────┼────────────────────┘ │
│ ▼ │
│ enrich → drain │
│ (User-Agent, geo, trace, …) │
└──────────────────────────────────────────────────────────────────┘
Every use case is opt-in. Adopt one, two, or all five — they coexist in the same logger, the same drain pipeline, and the same enrich chain.
Where to go next
- Building a new use case from scratch? Start with Wide Events for the conceptual model.
- Need to send the resulting events somewhere? Pick an adapter.
- Want to write your own use case as a reusable enricher / plugin? See Custom Enrichers or Plugins.
CLI
Observability for command-line tools. One wide event per command, drain pipeline, optional error and audit catalogs. Your citty and Clack stack stays unchanged.
Client Logging
Capture browser events with structured logging. Same API as the server, with automatic console styling, user identity context, and optional server transport.