# evlog ## Documentation Sets - [evlog](https://www.evlog.dev/llms-full.txt) ## Docs - [evlog — Digging through logs is not observability. It's hope.](https://www.evlog.dev/raw/landing.md): A modern TypeScript logger built for everything you ship — scripts, libraries, jobs, edge, requests. Simple logs, wide events, and structured errors in one API. - [Introduction](https://www.evlog.dev/raw/start/introduction.md): A modern TypeScript logger built for everything you ship. Simple structured logs, wide events, and structured errors in one API — drop-in for console.log, pino, or consola. - [Install evlog](https://www.evlog.dev/raw/start/installation.md): Install evlog in your TypeScript project. Supports Nuxt, Next.js, SvelteKit, Hono, Express, Fastify, Elysia, NestJS, and standalone scripts. - [Quick Start](https://www.evlog.dev/raw/start/quick-start.md): Get up and running with evlog in minutes. Learn the log API, createLogger for wide events, useLogger for requests, and structured errors. - [Learn evlog](https://www.evlog.dev/raw/learn/overview.md): The mental model — three logging modes, the wide event lifecycle, sampling, typed fields, and redaction. Read this section in order if you're new; pick what you need if you're not. - [Simple Logging](https://www.evlog.dev/raw/learn/simple-logging.md): evlog's general-purpose logger. A drop-in for console.log, pino, or consola, with the same level filtering, drain pipeline, redaction, and pretty/JSON output as wide events. - [Wide Events](https://www.evlog.dev/raw/learn/wide-events.md): Accumulate context over any unit of work and emit a single comprehensive event. Works for HTTP requests, scripts, background jobs, queue workers, and workflows. - [Structured Errors](https://www.evlog.dev/raw/learn/structured-errors.md): Create errors that explain why they occurred and how to fix them. Add actionable context with why, fix, and link fields for humans and AI agents. - [Lifecycle](https://www.evlog.dev/raw/learn/lifecycle.md): Understand the full lifecycle of an evlog event, from creation to drain. Covers all three modes (simple logging, wide events, request logging), sampling, enrichment, and delivery. - [Sampling](https://www.evlog.dev/raw/learn/sampling.md): Control log volume with two-tier sampling. Head sampling drops noise by level, tail sampling rescues critical events based on outcome. Never miss errors, slow requests, or critical paths. - [Auto-Redaction](https://www.evlog.dev/raw/learn/redaction.md): Automatically scrub PII from wide events before console output and drains. Built-in smart masking for credit cards, emails, IPs, phone numbers, JWTs, and more. - [Typed Fields](https://www.evlog.dev/raw/learn/typed-fields.md): Add compile-time type safety to your wide events with TypeScript module augmentation. Prevent typos and ensure consistent field names across your codebase. - [Catalogs](https://www.evlog.dev/raw/learn/catalogs.md): Scale typed error and audit catalogs from a single file to multi-package monorepos. Conventions, npm packaging recipe, composition patterns, and the type-augmentation deep dive. - [Integrate evlog](https://www.evlog.dev/raw/integrate/overview.md): Wire evlog into your stack — pick a framework integration to capture requests automatically, then pick adapters to ship events to Axiom, Sentry, PostHog, OTLP, and more. Frameworks decide where the logger lives; adapters decide where events go. - [Adapters Overview](https://www.evlog.dev/raw/integrate/adapters/overview.md): Send your logs to external services with evlog adapters. Built-in support for popular observability platforms and custom destinations. - [Axiom Adapter](https://www.evlog.dev/raw/integrate/adapters/cloud/axiom.md): Send wide events to Axiom for powerful querying, dashboards, and alerting. Zero-config setup with environment variables and automatic batching. - [OTLP Adapter](https://www.evlog.dev/raw/integrate/adapters/cloud/otlp.md): Send logs via OpenTelemetry Protocol (OTLP) to Grafana, Datadog, Honeycomb, and any compatible backend. Supports gRPC and HTTP transports. - [PostHog Adapter](https://www.evlog.dev/raw/integrate/adapters/cloud/posthog.md): Send wide events to PostHog Logs via OTLP for structured log querying, debugging, and observability in your PostHog dashboard. - [Sentry Adapter](https://www.evlog.dev/raw/integrate/adapters/cloud/sentry.md): Send structured logs to Sentry Logs for high-cardinality querying and debugging. Zero-config setup with environment variables. - [Better Stack Adapter](https://www.evlog.dev/raw/integrate/adapters/cloud/better-stack.md): Send wide events to Better Stack (formerly Logtail) for log management, alerting, and dashboards. Zero-config setup with environment variables. - [Datadog Adapter](https://www.evlog.dev/raw/integrate/adapters/cloud/datadog.md): Send wide events to Datadog Logs via the native HTTP intake API. Supports all Datadog sites and DD_* environment variables. - [HyperDX Adapter](https://www.evlog.dev/raw/integrate/adapters/cloud/hyperdx.md): Send wide events to HyperDX via OTLP/HTTP using HyperDX’s documented OpenTelemetry endpoint and authorization header. Zero-config setup with environment variables. - [File System Adapter](https://www.evlog.dev/raw/integrate/adapters/self-hosted/fs.md): Write wide events to the local file system as NDJSON for local debugging, AI agent integration, and production backup. - [NuxtHub Storage](https://www.evlog.dev/raw/integrate/adapters/self-hosted/nuxthub.md): Self-hosted log retention for evlog using NuxtHub database storage. Store, query, and automatically clean up your structured logs with zero external dependencies. - [Framework Integrations](https://www.evlog.dev/raw/integrate/frameworks/overview.md): evlog supports every major TypeScript framework. Choose your stack and get started in minutes. - [Nuxt](https://www.evlog.dev/raw/integrate/frameworks/nuxt.md): Automatic wide events, structured errors, drain adapters, enrichers, tail sampling, and client transport in Nuxt applications. - [Next.js](https://www.evlog.dev/raw/integrate/frameworks/nextjs.md): Wide events, structured errors, drain pipeline, tail sampling, route-based services, error handling, and client-side logging in Next.js applications. - [SvelteKit](https://www.evlog.dev/raw/integrate/frameworks/sveltekit.md): Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in SvelteKit applications. - [Nitro](https://www.evlog.dev/raw/integrate/frameworks/nitro.md): Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in Nitro v2 and v3 applications. - [TanStack Start](https://www.evlog.dev/raw/integrate/frameworks/tanstack-start.md): Automatic wide events, structured errors, and logging in TanStack Start API routes and server functions. - [NestJS](https://www.evlog.dev/raw/integrate/frameworks/nestjs.md): Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in NestJS applications. - [Express](https://www.evlog.dev/raw/integrate/frameworks/express.md): Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in Express applications. - [Hono](https://www.evlog.dev/raw/integrate/frameworks/hono.md): Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in Hono applications. - [Fastify](https://www.evlog.dev/raw/integrate/frameworks/fastify.md): Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in Fastify applications. - [Elysia](https://www.evlog.dev/raw/integrate/frameworks/elysia.md): Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in Elysia applications. - [React Router](https://www.evlog.dev/raw/integrate/frameworks/react-router.md): Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in React Router applications. - [Cloudflare Workers](https://www.evlog.dev/raw/integrate/frameworks/cloudflare-workers.md): Wide events, structured errors, and logging in Cloudflare Workers and Durable Objects. - [Standalone TypeScript](https://www.evlog.dev/raw/integrate/frameworks/standalone.md): Use evlog in standalone TypeScript scripts, CLI tools, queues, cron jobs, and any TypeScript process. - [Astro](https://www.evlog.dev/raw/integrate/frameworks/astro.md): Wide events and structured errors in Astro server middleware. - [AWS Lambda](https://www.evlog.dev/raw/integrate/frameworks/aws-lambda.md): Wide events and structured logging in AWS Lambda functions, including SQS consumers and event-driven handlers. - [Use Cases](https://www.evlog.dev/raw/use-cases/overview.md): Recipes that solve a specific problem with evlog — capture browser logs, observe AI SDK calls, identify users from Better Auth, build a tamper-evident audit trail, enrich every event with derived context. - [Client Logging](https://www.evlog.dev/raw/use-cases/client-logging.md): Capture browser events with structured logging. Same API as the server, with automatic console styling, user identity context, and optional server transport. - [AI SDK Integration](https://www.evlog.dev/raw/use-cases/ai-sdk/overview.md): Capture token usage, tool calls, model info, and streaming metrics from the Vercel AI SDK into wide events. Wrap your model and get full AI observability with one line. - [Usage Patterns](https://www.evlog.dev/raw/use-cases/ai-sdk/usage.md): streamText, generateText, multi-step agents, RAG, and multiple models — every common AI SDK pattern wired into evlog. - [Options](https://www.evlog.dev/raw/use-cases/ai-sdk/options.md): Configure tool input capture (with redaction and truncation), enable cost estimation per model, and handle errors during AI calls. - [Access Metadata](https://www.evlog.dev/raw/use-cases/ai-sdk/metadata.md): Read AI metadata from your handler — persist it, surface it to end-users, bill against it, or stream incremental progress to the client. - [Deeper Telemetry](https://www.evlog.dev/raw/use-cases/ai-sdk/telemetry.md): Add tool execution timing and total wall time with createEvlogIntegration. Compose with other middleware like supermemory or guardrails. - [Better Auth Integration](https://www.evlog.dev/raw/use-cases/better-auth/overview.md): Automatically identify users on every request. Every wide event includes who made the request — userId, user profile, and session metadata — with zero manual work. - [identifyUser](https://www.evlog.dev/raw/use-cases/better-auth/identify-user.md): The core building block — extract safe user fields, mask emails, and capture plugin data (organizations, roles, 2FA) from a Better Auth session. - [createAuthMiddleware](https://www.evlog.dev/raw/use-cases/better-auth/middleware.md): Framework-agnostic factory with route filtering, session timing, and lifecycle hooks. Call it once at startup and reuse across requests. - [Client Identity Sync](https://www.evlog.dev/raw/use-cases/better-auth/client-sync.md): Mirror the server-side user identity into client-side logs by watching the Better Auth session and calling setIdentity. - [Performance & Composition](https://www.evlog.dev/raw/use-cases/better-auth/performance.md): Watch session resolution time, enable session caching, wire the standalone Nitro hook, and combine with the AI SDK integration. - [Audit Logs](https://www.evlog.dev/raw/use-cases/audit/overview.md): First-class audit logs as a thin layer on top of evlog's wide events. Add tamper-evident audit trails to any app with one enricher, one drain wrapper, and one helper. - [Audit Schema](https://www.evlog.dev/raw/use-cases/audit/schema.md): The AuditFields type, action naming conventions, actor types, idempotency, and how the schema sits inside a regular wide event. - [Recording Events](https://www.evlog.dev/raw/use-cases/audit/recording.md): log.audit, log.audit.deny, standalone audit(), withAudit auto-instrumentation, defineAuditAction and defineAuditCatalog registries, and auditDiff change patches. - [Drains & Integrity](https://www.evlog.dev/raw/use-cases/audit/pipeline.md): auditEnricher to auto-fill request context, auditOnly to route audits to a dedicated sink, and signed for tamper-evident HMAC or hash-chain integrity. - [Compliance](https://www.evlog.dev/raw/use-cases/audit/compliance.md): Integrity, redact presets, GDPR vs append-only, retention windows, and the most common pitfalls when shipping audit logs to production. - [Recipes & Reference](https://www.evlog.dev/raw/use-cases/audit/recipes.md): File system, Axiom, and Postgres recipes for audit logs, plus mockAudit for tests and the full API reference. - [Enrichers](https://www.evlog.dev/raw/use-cases/enrichers.md): Add derived context to every wide event automatically — user agent, geo, request size, and trace context. Built-in enrichers from evlog/enrichers, plus how to compose them with your own. - [Extend evlog](https://www.evlog.dev/raw/extend/overview.md): Observe what flows through the pipeline (stream, fs reader, consumer recipes), plug into the pipeline (plugins, enrichers, tail sampling, identity headers), or build your own bricks (custom drains, drain pipeline, custom framework integration). - [Stream](https://www.evlog.dev/raw/extend/stream.md): Subscribe to wide events flowing through evlog — in-process with createStreamDrain, or over the network with the local SSE stream server. - [Custom Framework Integration](https://www.evlog.dev/raw/extend/custom-framework.md): Build evlog support for an HTTP framework (or non-HTTP runtime) without a built-in integration. Use defineFrameworkIntegration for the (ctx, next) middleware shape, or createMiddlewareLogger / createRequestLogger for everything else. - [FS reader](https://www.evlog.dev/raw/extend/fs-reader.md): Replay and tail the local NDJSON drain with readFsLogs and tailFsLogs — works in-process or from any external Node tool, survives restarts. - [Recipes](https://www.evlog.dev/raw/extend/consumer-recipes.md): Concrete copy-paste recipes — build your own minimal devtool, pipe to curl + jq, replay history then go live, and aggregate on the consumer side. - [Plugins](https://www.evlog.dev/raw/extend/plugins.md): definePlugin is the canonical extension point for evlog — opt into any subset of setup, onRequestStart, enrich, keep, drain, onRequestFinish, onClientLog, extendLogger from a single cohesive object. - [Custom Enrichers](https://www.evlog.dev/raw/extend/custom-enrichers.md): Write custom enrichers to add derived context to your wide events. Add deployment metadata, tenant IDs, feature flags, geo, or any computed data — the toolkit handles error isolation, undefined skipping, and the merge step. - [Tail Sampling](https://www.evlog.dev/raw/extend/tail-sampling.md): Decide post-hoc whether to keep an event with full knowledge of its outcome (status, duration, errors). The opposite of head sampling — keep all errors and slow requests while throwing away healthy noise. - [Identity Headers](https://www.evlog.dev/raw/extend/identity-headers.md): Every drain request sent by evlog is tagged with User-Agent and X-Evlog-Source headers so receivers can identify and triage the traffic. Override or suppress them when your custom drain needs different identity. - [Custom Drains](https://www.evlog.dev/raw/extend/custom-drains.md): Build a drain for any backend without a built-in adapter — defineHttpDrain for HTTP destinations, defineDrain for any other transport. Standardized config resolution, retries, timeouts, and identity headers handled for you. - [Drain Pipeline](https://www.evlog.dev/raw/extend/drain-pipeline.md): Batch events, retry on failure, fan out to multiple destinations, and ship browser logs to your server. The shared pipeline that wraps every drain in production. - [Configuration](https://www.evlog.dev/raw/reference/configuration.md): Complete reference for all evlog configuration options including global logger settings, middleware options, environment context, and framework-specific overrides. - [Performance](https://www.evlog.dev/raw/reference/performance.md): evlog adds ~3µs per request. Faster than pino, consola, and winston in most scenarios while emitting richer, more useful events. - [Vite Plugin](https://www.evlog.dev/raw/reference/vite-plugin.md): Build-time optimizations for any Vite-based framework. Auto-init, debug stripping, source location injection, and optional auto-imports. - [Best Practices](https://www.evlog.dev/raw/reference/best-practices.md): Security guidelines, data sanitization, and production tips for evlog. Learn what not to log and how to protect sensitive data. - [evlog vs pino, winston, consola](https://www.evlog.dev/raw/reference/vs-other-loggers.md): Side-by-side comparison of evlog with pino, winston, and consola. Feature parity matrix, honest gaps, and migration snippets so you can switch with no surprises. - [Agent Skills](https://www.evlog.dev/raw/reference/agent-skills.md): AI-assisted code review and evlog adoption using Agent Skills. Let AI review your logging patterns and guide migration to wide events.