# 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/getting-started/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/getting-started/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/getting-started/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. - [Agent Skills](https://www.evlog.dev/raw/getting-started/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. - [evlog vs pino, winston, consola](https://www.evlog.dev/raw/getting-started/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. - [Logging Overview](https://www.evlog.dev/raw/logging/overview.md): evlog gives you three ways to log. Simple one-liners, wide events that accumulate context, and auto-managed request logging. Choose the right one for your use case. - [Simple Logging](https://www.evlog.dev/raw/logging/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/logging/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/logging/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. - [Client Logging](https://www.evlog.dev/raw/logging/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/logging/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/logging/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/logging/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/logging/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/logging/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/logging/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/logging/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/logging/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/logging/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/logging/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/logging/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/logging/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/logging/audit/recording.md): log.audit, log.audit.deny, standalone audit(), withAudit auto-instrumentation, defineAuditAction registries, and auditDiff change patches. - [Drains & Integrity](https://www.evlog.dev/raw/logging/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/logging/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/logging/audit/recipes.md): File system, Axiom, and Postgres recipes for audit logs, plus mockAudit for tests and the full API reference. - [Lifecycle](https://www.evlog.dev/raw/core-concepts/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. - [Configuration](https://www.evlog.dev/raw/core-concepts/configuration.md): Complete reference for all evlog configuration options including global logger settings, middleware options, environment context, and framework-specific overrides. - [Sampling](https://www.evlog.dev/raw/core-concepts/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. - [Typed Fields](https://www.evlog.dev/raw/core-concepts/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. - [Best Practices](https://www.evlog.dev/raw/core-concepts/best-practices.md): Security guidelines, data sanitization, and production tips for evlog. Learn what not to log and how to protect sensitive data. - [Performance](https://www.evlog.dev/raw/core-concepts/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/core-concepts/vite-plugin.md): Build-time optimizations for any Vite-based framework. Auto-init, debug stripping, source location injection, and optional auto-imports. - [Auto-Redaction](https://www.evlog.dev/raw/core-concepts/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. - [Framework Integrations](https://www.evlog.dev/raw/frameworks/overview.md): evlog supports every major TypeScript framework. Choose your stack and get started in minutes. - [Nuxt](https://www.evlog.dev/raw/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/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/frameworks/sveltekit.md): Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in SvelteKit applications. - [Nitro](https://www.evlog.dev/raw/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/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/frameworks/nestjs.md): Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in NestJS applications. - [Express](https://www.evlog.dev/raw/frameworks/express.md): Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in Express applications. - [Hono](https://www.evlog.dev/raw/frameworks/hono.md): Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in Hono applications. - [Fastify](https://www.evlog.dev/raw/frameworks/fastify.md): Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in Fastify applications. - [Elysia](https://www.evlog.dev/raw/frameworks/elysia.md): Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in Elysia applications. - [React Router](https://www.evlog.dev/raw/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/frameworks/cloudflare-workers.md): Wide events, structured errors, and logging in Cloudflare Workers and Durable Objects. - [Standalone TypeScript](https://www.evlog.dev/raw/frameworks/standalone.md): Use evlog in standalone TypeScript scripts, CLI tools, queues, cron jobs, and any TypeScript process. - [Astro](https://www.evlog.dev/raw/frameworks/astro.md): Wide events and structured errors in Astro server middleware. - [AWS Lambda](https://www.evlog.dev/raw/frameworks/aws-lambda.md): Wide events and structured logging in AWS Lambda functions, including SQS consumers and event-driven handlers. - [Custom Integration](https://www.evlog.dev/raw/frameworks/custom-integration.md): Build your own evlog framework integration using the toolkit API — defineFrameworkIntegration, createMiddlewareLogger, AsyncLocalStorage, and the full drain/enrich/keep pipeline. - [Adapters Overview](https://www.evlog.dev/raw/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/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/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/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/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/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/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/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/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/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. - [Drain Pipeline](https://www.evlog.dev/raw/adapters/building-blocks/pipeline.md): Batch events, retry on failure, and protect against buffer overflow with the shared drain pipeline. Supports fan-out to multiple adapters. - [HTTP drain](https://www.evlog.dev/raw/adapters/building-blocks/http.md): Framework-agnostic HTTP log transport for sending client-side logs to your server via fetch or sendBeacon. Works in the browser or any environment with fetch. Use the `evlog/http` entry point. - [Custom Adapters](https://www.evlog.dev/raw/adapters/building-blocks/custom.md): Build your own adapter to send logs to any destination using defineHttpDrain — config resolution, retries, timeouts, and error handling are handled for you. - [Toolkit Reference](https://www.evlog.dev/raw/adapters/building-blocks/toolkit.md): The evlog/toolkit public API — every primitive used to build adapters, enrichers, plugins, and framework integrations. - [Enrichers Overview](https://www.evlog.dev/raw/enrichers/overview.md): Enrich your wide events with derived context like user agent, geo data, request size, and trace context. Built-in enrichers and custom enricher support. - [Built-in Enrichers](https://www.evlog.dev/raw/enrichers/built-in.md): Reference for all built-in evlog enrichers. Parse user agents, extract geo data, measure request sizes, and capture trace context automatically. - [Custom Enrichers](https://www.evlog.dev/raw/enrichers/custom.md): Write custom enrichers to add derived context to your wide events. Add deployment metadata, tenant IDs, feature flags, or any computed data.