Wide Events
Capture all context about a complete operation in ONE structured event.
The Problem with Traditional Logging
Traditional logging scatters information across many log lines:
typescript
Problems:
- 7 separate log lines to correlate
- Missing context in each line
- Hard to query across dimensions
- Expensive at scale (7x the cost)
The Wide Events Solution
Wide Events (also called Canonical Log Lines) emit ONE comprehensive event per operation:
typescript
Output: ONE event with 50+ fields, easily queryable
json
Why Wide Events?
| Benefit | Description |
|---|---|
| Debug Faster | All context in one place, no log correlation needed |
| Reduce Costs | 1 event vs 7+ log lines = 85%+ cost reduction |
| Better Queries | "Slow requests from premium users with payment errors" |
| No Missing Context | You'll never lose the request that caused an error |
API Reference
createWideEvent(config)
Create a new wide event builder:
typescript
Builder Methods
typescript
event.end(options)
Complete the event and prepare for emission:
typescript
logger.emitWideEvent(event)
Emit a completed wide event through the logger's transports:
typescript
Field Categories
Organize your fields by category for clean, queryable events:
typescript
Event Schemas
Vestig provides TypeScript interfaces for common event types:
HTTP Request Events
typescript
Background Job Events
typescript
Best Practices
1. Create Early, Enrich Throughout
typescript
2. Handle Errors Gracefully
typescript
3. Use Consistent Field Names
typescript
4. Include Business Context
typescript
Complete Example
typescript
Next Steps
- Tail Sampling — Keep 100% of errors, sample success
- Next.js Integration — Automatic wide events for Next.js