Logging that
makes sense.
Wide events and structured errors for TypeScript. One log per request. Full context. Errors that explain why.
Features
Everything you need.
Wide Events
Accumulate context throughout your request. Emit once at the end with everything you need.
log.set({ user: { id, plan } })
log.set({ cart: { items, total } })
// → One event with all contextStructured Errors
Errors that explain why they happened and how to fix them.
throw createError({
message: 'Payment failed',
why: 'Card declined',
fix: 'Try another card',
})Log Draining
Send logs to external services in fire-and-forget mode. Never blocks your response.
nitroApp.hooks.hook('evlog:drain',
async (ctx) => {
await sendToAxiom(ctx.event)
}
)Built-in Adapters
Zero-config adapters for Axiom, OTLP (Grafana, Datadog, Honeycomb), or build your own.
import { createAxiomDrain } from 'evlog/axiom'
import { createOTLPDrain } from 'evlog/otlp'
// Reads config from env varsSmart Sampling
Head and tail sampling. Keep errors and slow requests, reduce noise.
sampling: {
rates: { info: 10, warn: 50 },
keep: [{ status: 400 }]
}Nuxt & Nitro
First-class integration. Auto-create loggers, auto-emit at request end.
export default defineNuxtConfig({
modules: ['evlog/nuxt'],
})Client Transport
Send browser logs to your server. Automatic enrichment with server context.
// Browser
log.info({ action: 'click' })
// → Sent to /api/_evlog/ingest
// → Enriched & drained server-sidePretty & JSON
Human-readable in dev, machine-parseable JSON in production.
[INFO] POST /api/checkout (234ms)
user: { id: 1, plan: "pro" }
cart: { items: 3 }Agent-Ready
Structured JSON output that AI agents can parse and understand.
{
"level": "error",
"why": "Card declined",
"fix": "Try another card"
}Simple API
Three lines of code.
Full observability.
export default defineEventHandler(async (event) => {
const log = useLogger(event)
log.set({ user: { id: user.id, plan: user.plan } })
log.set({ cart: { items: 3, total: 9999 } })
return { success: true }
})✓ One log with full context
Structured Errors
Errors that explain why.
throw createError({
message: 'Payment failed',
status: 402,
why: 'Card declined by issuer',
fix: 'Try a different card',
})✓ Actionable error messages
Get Started
Stop grep-ing through chaos.
Wide events, structured errors, zero config. Ship with the logging your future self will thank you for.
export default defineNuxtConfig({
modules: ['evlog/nuxt'],
})