[{"data":1,"prerenderedAt":3508},["ShallowReactive",2],{"navigation_docs":3,"-frameworks-tanstack-start":421,"-frameworks-tanstack-start-surround":3503},[4,35,159,201,289,318,405],{"title":5,"path":6,"stem":7,"children":8,"page":34},"Getting Started","\u002Fgetting-started","1.getting-started",[9,14,19,24,29],{"title":10,"path":11,"stem":12,"icon":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction","i-lucide-info",{"title":15,"path":16,"stem":17,"icon":18},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation","i-lucide-download",{"title":20,"path":21,"stem":22,"icon":23},"Quick Start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start","i-lucide-zap",{"title":25,"path":26,"stem":27,"icon":28},"Agent Skills","\u002Fgetting-started\u002Fagent-skills","1.getting-started\u002F4.agent-skills","i-lucide-sparkles",{"title":30,"path":31,"stem":32,"icon":33},"vs Other Loggers","\u002Fgetting-started\u002Fvs-other-loggers","1.getting-started\u002F5.vs-other-loggers","i-lucide-scale",false,{"title":36,"path":37,"stem":38,"children":39,"page":34},"Logging","\u002Flogging","2.logging",[40,45,50,55,60,65,70,99,127],{"title":41,"path":42,"stem":43,"icon":44},"Overview","\u002Flogging\u002Foverview","2.logging\u002F0.overview","i-lucide-list",{"title":46,"path":47,"stem":48,"icon":49},"Simple Logging","\u002Flogging\u002Fsimple-logging","2.logging\u002F1.simple-logging","i-lucide-terminal",{"title":51,"path":52,"stem":53,"icon":54},"Wide Events","\u002Flogging\u002Fwide-events","2.logging\u002F2.wide-events","i-lucide-layers",{"title":56,"path":57,"stem":58,"icon":59},"Structured Errors","\u002Flogging\u002Fstructured-errors","2.logging\u002F3.structured-errors","i-lucide-shield-alert",{"title":61,"path":62,"stem":63,"icon":64},"Catalogs","\u002Flogging\u002Fcatalogs","2.logging\u002F4.catalogs","i-lucide-book-open",{"title":66,"path":67,"stem":68,"icon":69},"Client Logging","\u002Flogging\u002Fclient-logging","2.logging\u002F5.client-logging","i-lucide-monitor",{"title":71,"icon":72,"path":73,"stem":74,"children":75,"page":34},"AI SDK","i-simple-icons-vercel","\u002Flogging\u002Fai-sdk","2.logging\u002F6.ai-sdk",[76,79,84,89,94],{"title":41,"path":77,"stem":78,"icon":44},"\u002Flogging\u002Fai-sdk\u002Foverview","2.logging\u002F6.ai-sdk\u002F01.overview",{"title":80,"path":81,"stem":82,"icon":83},"Usage","\u002Flogging\u002Fai-sdk\u002Fusage","2.logging\u002F6.ai-sdk\u002F02.usage","i-lucide-code",{"title":85,"path":86,"stem":87,"icon":88},"Options","\u002Flogging\u002Fai-sdk\u002Foptions","2.logging\u002F6.ai-sdk\u002F03.options","i-lucide-sliders",{"title":90,"path":91,"stem":92,"icon":93},"Metadata","\u002Flogging\u002Fai-sdk\u002Fmetadata","2.logging\u002F6.ai-sdk\u002F04.metadata","i-lucide-database",{"title":95,"path":96,"stem":97,"icon":98},"Telemetry","\u002Flogging\u002Fai-sdk\u002Ftelemetry","2.logging\u002F6.ai-sdk\u002F05.telemetry","i-lucide-activity",{"title":100,"icon":101,"path":102,"stem":103,"children":104,"page":34},"Better Auth","i-simple-icons-betterauth","\u002Flogging\u002Fbetter-auth","2.logging\u002F7.better-auth",[105,108,113,118,122],{"title":41,"path":106,"stem":107,"icon":44},"\u002Flogging\u002Fbetter-auth\u002Foverview","2.logging\u002F7.better-auth\u002F01.overview",{"title":109,"path":110,"stem":111,"icon":112},"Identify User","\u002Flogging\u002Fbetter-auth\u002Fidentify-user","2.logging\u002F7.better-auth\u002F02.identify-user","i-lucide-user-check",{"title":114,"path":115,"stem":116,"icon":117},"Middleware","\u002Flogging\u002Fbetter-auth\u002Fmiddleware","2.logging\u002F7.better-auth\u002F03.middleware","i-lucide-shield",{"title":119,"path":120,"stem":121,"icon":69},"Client Sync","\u002Flogging\u002Fbetter-auth\u002Fclient-sync","2.logging\u002F7.better-auth\u002F04.client-sync",{"title":123,"path":124,"stem":125,"icon":126},"Performance","\u002Flogging\u002Fbetter-auth\u002Fperformance","2.logging\u002F7.better-auth\u002F05.performance","i-lucide-gauge",{"title":128,"icon":129,"path":130,"stem":131,"children":132,"page":34},"Audit Logs","i-lucide-shield-check","\u002Flogging\u002Faudit","2.logging\u002F8.audit",[133,136,141,146,151,155],{"title":41,"path":134,"stem":135,"icon":44},"\u002Flogging\u002Faudit\u002Foverview","2.logging\u002F8.audit\u002F01.overview",{"title":137,"path":138,"stem":139,"icon":140},"Schema","\u002Flogging\u002Faudit\u002Fschema","2.logging\u002F8.audit\u002F02.schema","i-lucide-file-text",{"title":142,"path":143,"stem":144,"icon":145},"Recording","\u002Flogging\u002Faudit\u002Frecording","2.logging\u002F8.audit\u002F03.recording","i-lucide-pen-line",{"title":147,"path":148,"stem":149,"icon":150},"Drains","\u002Flogging\u002Faudit\u002Fpipeline","2.logging\u002F8.audit\u002F04.pipeline","i-lucide-link",{"title":152,"path":153,"stem":154,"icon":129},"Compliance","\u002Flogging\u002Faudit\u002Fcompliance","2.logging\u002F8.audit\u002F05.compliance",{"title":156,"path":157,"stem":158,"icon":64},"Recipes","\u002Flogging\u002Faudit\u002Frecipes","2.logging\u002F8.audit\u002F06.recipes",{"title":160,"path":161,"stem":162,"children":163,"page":34},"Core Concepts","\u002Fcore-concepts","3.core-concepts",[164,169,174,179,184,188,191,196],{"title":165,"path":166,"stem":167,"icon":168},"Lifecycle","\u002Fcore-concepts\u002Flifecycle","3.core-concepts\u002F0.lifecycle","i-lucide-arrow-right-left",{"title":170,"path":171,"stem":172,"icon":173},"Configuration","\u002Fcore-concepts\u002Fconfiguration","3.core-concepts\u002F1.configuration","i-lucide-settings",{"title":175,"path":176,"stem":177,"icon":178},"Sampling","\u002Fcore-concepts\u002Fsampling","3.core-concepts\u002F2.sampling","i-lucide-filter",{"title":180,"path":181,"stem":182,"icon":183},"Typed Fields","\u002Fcore-concepts\u002Ftyped-fields","3.core-concepts\u002F3.typed-fields","i-simple-icons-typescript",{"title":185,"path":186,"stem":187,"icon":129},"Best Practices","\u002Fcore-concepts\u002Fbest-practices","3.core-concepts\u002F4.best-practices",{"title":123,"path":189,"stem":190,"icon":126},"\u002Fcore-concepts\u002Fperformance","3.core-concepts\u002F5.performance",{"title":192,"path":193,"stem":194,"icon":195},"Vite Plugin","\u002Fcore-concepts\u002Fvite-plugin","3.core-concepts\u002F6.vite-plugin","i-custom-vite",{"title":197,"path":198,"stem":199,"icon":200},"Auto-Redaction","\u002Fcore-concepts\u002Fredaction","3.core-concepts\u002F7.redaction","i-lucide-eye-off",{"title":202,"path":203,"stem":204,"children":205,"page":34},"Frameworks","\u002Fframeworks","4.frameworks",[206,210,215,220,225,230,235,240,245,250,255,260,265,270,274,279,284],{"title":41,"path":207,"stem":208,"icon":209},"\u002Fframeworks\u002Foverview","4.frameworks\u002F00.overview","i-lucide-layout-grid",{"title":211,"path":212,"stem":213,"icon":214},"Nuxt","\u002Fframeworks\u002Fnuxt","4.frameworks\u002F01.nuxt","i-simple-icons-nuxtdotjs",{"title":216,"path":217,"stem":218,"icon":219},"Next.js","\u002Fframeworks\u002Fnextjs","4.frameworks\u002F02.nextjs","i-simple-icons-nextdotjs",{"title":221,"path":222,"stem":223,"icon":224},"SvelteKit","\u002Fframeworks\u002Fsveltekit","4.frameworks\u002F03.sveltekit","i-simple-icons-svelte",{"title":226,"path":227,"stem":228,"icon":229},"Nitro","\u002Fframeworks\u002Fnitro","4.frameworks\u002F04.nitro","i-custom-nitro",{"title":231,"path":232,"stem":233,"icon":234},"TanStack Start","\u002Fframeworks\u002Ftanstack-start","4.frameworks\u002F05.tanstack-start","i-custom-tanstack",{"title":236,"path":237,"stem":238,"icon":239},"NestJS","\u002Fframeworks\u002Fnestjs","4.frameworks\u002F06.nestjs","i-simple-icons-nestjs",{"title":241,"path":242,"stem":243,"icon":244},"Express","\u002Fframeworks\u002Fexpress","4.frameworks\u002F07.express","i-simple-icons-express",{"title":246,"path":247,"stem":248,"icon":249},"Hono","\u002Fframeworks\u002Fhono","4.frameworks\u002F08.hono","i-simple-icons-hono",{"title":251,"path":252,"stem":253,"icon":254},"Fastify","\u002Fframeworks\u002Ffastify","4.frameworks\u002F09.fastify","i-simple-icons-fastify",{"title":256,"path":257,"stem":258,"icon":259},"Elysia","\u002Fframeworks\u002Felysia","4.frameworks\u002F10.elysia","i-custom-elysia",{"title":261,"path":262,"stem":263,"icon":264},"React Router","\u002Fframeworks\u002Freact-router","4.frameworks\u002F11.react-router","i-custom-reactrouter",{"title":266,"path":267,"stem":268,"icon":269},"Cloudflare Workers","\u002Fframeworks\u002Fcloudflare-workers","4.frameworks\u002F12.cloudflare-workers","i-simple-icons-cloudflare",{"title":271,"path":272,"stem":273,"icon":183},"Standalone","\u002Fframeworks\u002Fstandalone","4.frameworks\u002F13.standalone",{"title":275,"path":276,"stem":277,"icon":278},"Astro","\u002Fframeworks\u002Fastro","4.frameworks\u002F14.astro","i-simple-icons-astro",{"title":280,"path":281,"stem":282,"icon":283},"AWS Lambda","\u002Fframeworks\u002Faws-lambda","4.frameworks\u002F16.aws-lambda","i-custom-lambda",{"title":285,"path":286,"stem":287,"icon":288},"Custom Integration","\u002Fframeworks\u002Fcustom-integration","4.frameworks\u002F17.custom-integration","i-lucide-puzzle",{"title":290,"path":291,"stem":292,"children":293,"page":34},"Build on top","\u002Fbuild-on-top","5.build-on-top",[294,299,304,309,314],{"title":295,"path":296,"stem":297,"icon":298},"Identity headers","\u002Fbuild-on-top\u002Fidentity-headers","5.build-on-top\u002F1.identity-headers","i-lucide-fingerprint",{"title":300,"path":301,"stem":302,"icon":303},"Stream API","\u002Fbuild-on-top\u002Fstream-api","5.build-on-top\u002F2.stream-api","i-lucide-radio-tower",{"title":305,"path":306,"stem":307,"icon":308},"SSE bridge","\u002Fbuild-on-top\u002Fsse-bridge","5.build-on-top\u002F3.sse-bridge","i-lucide-wifi",{"title":310,"path":311,"stem":312,"icon":313},"FS reader","\u002Fbuild-on-top\u002Ffs-reader","5.build-on-top\u002F4.fs-reader","i-lucide-folder-search",{"title":156,"path":315,"stem":316,"icon":317},"\u002Fbuild-on-top\u002Frecipes","5.build-on-top\u002F4.recipes","i-lucide-chef-hat",{"title":319,"path":320,"stem":321,"children":322,"page":34},"Adapters","\u002Fadapters","6.adapters",[323,326,366,381],{"title":41,"path":324,"stem":325,"icon":44},"\u002Fadapters\u002Foverview","6.adapters\u002F01.overview",{"title":327,"path":328,"stem":329,"children":330,"page":34},"Cloud destinations","\u002Fadapters\u002Fcloud","6.adapters\u002F02.cloud",[331,336,341,346,351,356,361],{"title":332,"path":333,"stem":334,"icon":335},"Axiom","\u002Fadapters\u002Fcloud\u002Faxiom","6.adapters\u002F02.cloud\u002F01.axiom","i-custom-axiom",{"title":337,"path":338,"stem":339,"icon":340},"OTLP","\u002Fadapters\u002Fcloud\u002Fotlp","6.adapters\u002F02.cloud\u002F02.otlp","i-simple-icons-opentelemetry",{"title":342,"path":343,"stem":344,"icon":345},"PostHog","\u002Fadapters\u002Fcloud\u002Fposthog","6.adapters\u002F02.cloud\u002F03.posthog","i-simple-icons-posthog",{"title":347,"path":348,"stem":349,"icon":350},"Sentry","\u002Fadapters\u002Fcloud\u002Fsentry","6.adapters\u002F02.cloud\u002F04.sentry","i-simple-icons-sentry",{"title":352,"path":353,"stem":354,"icon":355},"Better Stack","\u002Fadapters\u002Fcloud\u002Fbetter-stack","6.adapters\u002F02.cloud\u002F05.better-stack","i-simple-icons-betterstack",{"title":357,"path":358,"stem":359,"icon":360},"Datadog","\u002Fadapters\u002Fcloud\u002Fdatadog","6.adapters\u002F02.cloud\u002F06.datadog","i-simple-icons-datadog",{"title":362,"path":363,"stem":364,"icon":365},"HyperDX","\u002Fadapters\u002Fcloud\u002Fhyperdx","6.adapters\u002F02.cloud\u002F07.hyperdx","i-custom-hyperdx",{"title":367,"path":368,"stem":369,"children":370,"page":34},"Self-hosted","\u002Fadapters\u002Fself-hosted","6.adapters\u002F03.self-hosted",[371,376],{"title":372,"path":373,"stem":374,"icon":375},"File System","\u002Fadapters\u002Fself-hosted\u002Ffs","6.adapters\u002F03.self-hosted\u002F01.fs","i-lucide-hard-drive",{"title":377,"path":378,"stem":379,"icon":380},"NuxtHub","\u002Fadapters\u002Fself-hosted\u002Fnuxthub","6.adapters\u002F03.self-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":382,"path":383,"stem":384,"children":385,"page":34},"Building blocks","\u002Fadapters\u002Fbuilding-blocks","6.adapters\u002F04.building-blocks",[386,391,396,400],{"title":387,"path":388,"stem":389,"icon":390},"Pipeline","\u002Fadapters\u002Fbuilding-blocks\u002Fpipeline","6.adapters\u002F04.building-blocks\u002F01.pipeline","i-lucide-workflow",{"title":392,"path":393,"stem":394,"icon":395},"HTTP","\u002Fadapters\u002Fbuilding-blocks\u002Fhttp","6.adapters\u002F04.building-blocks\u002F02.http","i-lucide-globe",{"title":397,"path":398,"stem":399,"icon":83},"Custom Adapters","\u002Fadapters\u002Fbuilding-blocks\u002Fcustom","6.adapters\u002F04.building-blocks\u002F03.custom",{"title":401,"path":402,"stem":403,"icon":404},"Toolkit","\u002Fadapters\u002Fbuilding-blocks\u002Ftoolkit","6.adapters\u002F04.building-blocks\u002F04.toolkit","i-lucide-blocks",{"title":406,"path":407,"stem":408,"children":409,"page":34},"Enrichers","\u002Fenrichers","7.enrichers",[410,413,417],{"title":41,"path":411,"stem":412,"icon":28},"\u002Fenrichers\u002Foverview","7.enrichers\u002F1.overview",{"title":414,"path":415,"stem":416,"icon":288},"Built-in","\u002Fenrichers\u002Fbuilt-in","7.enrichers\u002F2.built-in",{"title":418,"path":419,"stem":420,"icon":83},"Custom","\u002Fenrichers\u002Fcustom","7.enrichers\u002F3.custom",{"id":422,"title":231,"body":423,"description":3493,"extension":3494,"links":3495,"meta":3499,"navigation":3500,"path":232,"seo":3501,"stem":233,"__hash__":3502},"docs\u002F4.frameworks\u002F05.tanstack-start.md",{"type":424,"value":425,"toc":3473},"minimark",[426,440,455,498,502,509,514,585,592,606,792,803,807,830,970,973,992,995,1009,1373,1376,1447,1456,1460,1474,2006,2009,2085,2089,2095,2333,2336,2347,2351,2362,2604,2608,2615,2738,2913,2920,2924,2931,3170,3181,3185,3192,3366,3370,3412,3420,3430,3434,3440,3469],[427,428,429,430,434,435,439],"p",{},"TanStack Start uses ",[431,432,433],"a",{"href":227},"Nitro v3"," as its server layer, so evlog integrates via the ",[436,437,438],"code",{},"evlog\u002Fnitro\u002Fv3"," module. The same plugin-based hooks system applies.",[441,442,444,448,449,451,452,454],"callout",{"color":443,"icon":13},"info",[445,446,447],"strong",{},"TanStack Router vs TanStack Start",": TanStack Router is a client-side router and doesn't need server-side logging. This page covers ",[445,450,231],{},", the full-stack framework. If you're using TanStack Router in SPA mode, see ",[431,453,66],{"href":67}," instead.",[456,457,460,463,485],"prompt",{":actions":458,"description":459,"icon":234},"[\"copy\",\"cursor\",\"windsurf\"]","Set up evlog in my TanStack Start app",[427,461,462],{},"Set up evlog in my TanStack Start app.",[464,465,466,470,473,476,479,482],"ul",{},[467,468,469],"li",{},"Install evlog: pnpm add evlog",[467,471,472],{},"Create nitro.config.ts with evlog\u002Fnitro\u002Fv3 module and experimental.asyncContext enabled",[467,474,475],{},"Configure env.service with your app name",[467,477,478],{},"Add evlogErrorHandler middleware to the root route for structured error responses",[467,480,481],{},"Access the logger via useRequest().context.log in route handlers",[467,483,484],{},"Use log.set() to accumulate context, throw createError() for structured errors",[427,486,487,488,493,494],{},"Docs: ",[431,489,490],{"href":490,"rel":491},"https:\u002F\u002Fwww.evlog.dev\u002Fframeworks\u002Ftanstack-start",[492],"nofollow","\nAdapters: ",[431,495,496],{"href":496,"rel":497},"https:\u002F\u002Fwww.evlog.dev\u002Fadapters",[492],[499,500,20],"h2",{"id":501},"quick-start",[427,503,504,505,508],{},"Starting from a TanStack Start project created with ",[436,506,507],{},"npm create @tanstack\u002Fstart@latest",":",[510,511,513],"h3",{"id":512},"_1-install","1. Install",[515,516,517,542,556,570],"code-group",{},[518,519,525],"pre",{"className":520,"code":521,"filename":522,"language":523,"meta":524,"style":524},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm add evlog\n","pnpm","bash","",[436,526,527],{"__ignoreMap":524},[528,529,532,535,539],"span",{"class":530,"line":531},"line",1,[528,533,522],{"class":534},"sBMFI",[528,536,538],{"class":537},"sfazB"," add",[528,540,541],{"class":537}," evlog\n",[518,543,546],{"className":520,"code":544,"filename":545,"language":523,"meta":524,"style":524},"bun add evlog\n","bun",[436,547,548],{"__ignoreMap":524},[528,549,550,552,554],{"class":530,"line":531},[528,551,545],{"class":534},[528,553,538],{"class":537},[528,555,541],{"class":537},[518,557,560],{"className":520,"code":558,"filename":559,"language":523,"meta":524,"style":524},"yarn add evlog\n","yarn",[436,561,562],{"__ignoreMap":524},[528,563,564,566,568],{"class":530,"line":531},[528,565,559],{"class":534},[528,567,538],{"class":537},[528,569,541],{"class":537},[518,571,574],{"className":520,"code":572,"filename":573,"language":523,"meta":524,"style":524},"npm install evlog\n","npm",[436,575,576],{"__ignoreMap":524},[528,577,578,580,583],{"class":530,"line":531},[528,579,573],{"class":534},[528,581,582],{"class":537}," install",[528,584,541],{"class":537},[510,586,588,589],{"id":587},"_2-add-nitroconfigts","2. Add ",[436,590,591],{},"nitro.config.ts",[427,593,594,595,597,598,601,602,605],{},"Create a ",[436,596,591],{}," at the project root to register the evlog module. Your ",[436,599,600],{},"vite.config.ts"," already has the ",[436,603,604],{},"nitro()"," plugin from the CLI, so no changes are needed there.",[518,607,611],{"className":608,"code":609,"filename":591,"language":610,"meta":524,"style":524},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { defineConfig } from 'nitro'\nimport evlog from 'evlog\u002Fnitro\u002Fv3'\n\nexport default defineConfig({\n  experimental: {\n    asyncContext: true,\n  },\n  modules: [\n    evlog({\n      env: { service: 'my-app' },\n    }),\n  ],\n})\n","typescript",[436,612,613,642,659,666,684,696,711,717,728,738,764,775,783],{"__ignoreMap":524},[528,614,615,619,623,627,630,633,636,639],{"class":530,"line":531},[528,616,618],{"class":617},"s7zQu","import",[528,620,622],{"class":621},"sMK4o"," {",[528,624,626],{"class":625},"sTEyZ"," defineConfig",[528,628,629],{"class":621}," }",[528,631,632],{"class":617}," from",[528,634,635],{"class":621}," '",[528,637,638],{"class":537},"nitro",[528,640,641],{"class":621},"'\n",[528,643,645,647,650,653,655,657],{"class":530,"line":644},2,[528,646,618],{"class":617},[528,648,649],{"class":625}," evlog ",[528,651,652],{"class":617},"from",[528,654,635],{"class":621},[528,656,438],{"class":537},[528,658,641],{"class":621},[528,660,662],{"class":530,"line":661},3,[528,663,665],{"emptyLinePlaceholder":664},true,"\n",[528,667,669,672,675,678,681],{"class":530,"line":668},4,[528,670,671],{"class":617},"export",[528,673,674],{"class":617}," default",[528,676,626],{"class":677},"s2Zo4",[528,679,680],{"class":625},"(",[528,682,683],{"class":621},"{\n",[528,685,687,691,693],{"class":530,"line":686},5,[528,688,690],{"class":689},"swJcz","  experimental",[528,692,508],{"class":621},[528,694,695],{"class":621}," {\n",[528,697,699,702,704,708],{"class":530,"line":698},6,[528,700,701],{"class":689},"    asyncContext",[528,703,508],{"class":621},[528,705,707],{"class":706},"sfNiH"," true",[528,709,710],{"class":621},",\n",[528,712,714],{"class":530,"line":713},7,[528,715,716],{"class":621},"  },\n",[528,718,720,723,725],{"class":530,"line":719},8,[528,721,722],{"class":689},"  modules",[528,724,508],{"class":621},[528,726,727],{"class":625}," [\n",[528,729,731,734,736],{"class":530,"line":730},9,[528,732,733],{"class":677},"    evlog",[528,735,680],{"class":625},[528,737,683],{"class":621},[528,739,741,744,746,748,751,753,755,758,761],{"class":530,"line":740},10,[528,742,743],{"class":689},"      env",[528,745,508],{"class":621},[528,747,622],{"class":621},[528,749,750],{"class":689}," service",[528,752,508],{"class":621},[528,754,635],{"class":621},[528,756,757],{"class":537},"my-app",[528,759,760],{"class":621},"'",[528,762,763],{"class":621}," },\n",[528,765,767,770,773],{"class":530,"line":766},11,[528,768,769],{"class":621},"    }",[528,771,772],{"class":625},")",[528,774,710],{"class":621},[528,776,778,781],{"class":530,"line":777},12,[528,779,780],{"class":625},"  ]",[528,782,710],{"class":621},[528,784,786,789],{"class":530,"line":785},13,[528,787,788],{"class":621},"}",[528,790,791],{"class":625},")\n",[427,793,794,795,798,799,802],{},"Enabling ",[436,796,797],{},"asyncContext"," lets you access the request-scoped logger from anywhere in the call stack via ",[436,800,801],{},"useRequest()",".",[510,804,806],{"id":805},"_3-error-handling-middleware","3. Error handling middleware",[427,808,809,810,813,814,817,818,821,822,825,826,829],{},"TanStack Start has its own error handling layer that runs before Nitro's. To ensure ",[436,811,812],{},"throw createError()"," returns a proper JSON response with ",[436,815,816],{},"why",", ",[436,819,820],{},"fix",", and ",[436,823,824],{},"link",", add the ",[436,827,828],{},"evlogErrorHandler"," middleware to your root route:",[518,831,834],{"className":608,"code":832,"filename":833,"language":610,"meta":524,"style":524},"import { createRootRoute } from '@tanstack\u002Freact-router'\nimport { createMiddleware } from '@tanstack\u002Freact-start'\nimport { evlogErrorHandler } from 'evlog\u002Fnitro\u002Fv3'\n\nexport const Route = createRootRoute({\n  server: {\n    middleware: [createMiddleware().server(evlogErrorHandler)],\n  },\n  \u002F\u002F ... head, shellComponent, etc.\n})\n","src\u002Froutes\u002F__root.tsx",[436,835,836,856,876,895,899,919,928,954,958,964],{"__ignoreMap":524},[528,837,838,840,842,845,847,849,851,854],{"class":530,"line":531},[528,839,618],{"class":617},[528,841,622],{"class":621},[528,843,844],{"class":625}," createRootRoute",[528,846,629],{"class":621},[528,848,632],{"class":617},[528,850,635],{"class":621},[528,852,853],{"class":537},"@tanstack\u002Freact-router",[528,855,641],{"class":621},[528,857,858,860,862,865,867,869,871,874],{"class":530,"line":644},[528,859,618],{"class":617},[528,861,622],{"class":621},[528,863,864],{"class":625}," createMiddleware",[528,866,629],{"class":621},[528,868,632],{"class":617},[528,870,635],{"class":621},[528,872,873],{"class":537},"@tanstack\u002Freact-start",[528,875,641],{"class":621},[528,877,878,880,882,885,887,889,891,893],{"class":530,"line":661},[528,879,618],{"class":617},[528,881,622],{"class":621},[528,883,884],{"class":625}," evlogErrorHandler",[528,886,629],{"class":621},[528,888,632],{"class":617},[528,890,635],{"class":621},[528,892,438],{"class":537},[528,894,641],{"class":621},[528,896,897],{"class":530,"line":668},[528,898,665],{"emptyLinePlaceholder":664},[528,900,901,903,907,910,913,915,917],{"class":530,"line":686},[528,902,671],{"class":617},[528,904,906],{"class":905},"spNyl"," const",[528,908,909],{"class":625}," Route ",[528,911,912],{"class":621},"=",[528,914,844],{"class":677},[528,916,680],{"class":625},[528,918,683],{"class":621},[528,920,921,924,926],{"class":530,"line":698},[528,922,923],{"class":689},"  server",[528,925,508],{"class":621},[528,927,695],{"class":621},[528,929,930,933,935,938,941,944,946,949,952],{"class":530,"line":713},[528,931,932],{"class":689},"    middleware",[528,934,508],{"class":621},[528,936,937],{"class":625}," [",[528,939,940],{"class":677},"createMiddleware",[528,942,943],{"class":625},"()",[528,945,802],{"class":621},[528,947,948],{"class":677},"server",[528,950,951],{"class":625},"(evlogErrorHandler)]",[528,953,710],{"class":621},[528,955,956],{"class":530,"line":719},[528,957,716],{"class":621},[528,959,960],{"class":530,"line":730},[528,961,963],{"class":962},"sHwdD","  \u002F\u002F ... head, shellComponent, etc.\n",[528,965,966,968],{"class":530,"line":740},[528,967,788],{"class":621},[528,969,791],{"class":625},[427,971,972],{},"That's it. evlog automatically captures every request as a wide event with method, path, status, and duration.",[441,974,975,978,979,984,985,988,989,991],{"color":443,"icon":195},[445,976,977],{},"Using Vite?"," TanStack Start is Vite-based. The ",[431,980,981],{"href":193},[436,982,983],{},"evlog\u002Fvite"," plugin strips ",[436,986,987],{},"log.debug()"," from production builds and injects source locations, add it to your ",[436,990,600],{}," alongside the TanStack Start plugin.",[499,993,51],{"id":994},"wide-events",[427,996,997,998,1001,1002,1004,1005,1008],{},"With ",[436,999,1000],{},"experimental.asyncContext: true",", use ",[436,1003,801],{}," from ",[436,1006,1007],{},"nitro\u002Fcontext"," to access the request-scoped logger and build up context progressively:",[518,1010,1013],{"className":608,"code":1011,"filename":1012,"language":610,"meta":524,"style":524},"import { createFileRoute } from '@tanstack\u002Freact-router'\nimport { useRequest } from 'nitro\u002Fcontext'\nimport type { RequestLogger } from 'evlog'\n\nexport const Route = createFileRoute('\u002Fapi\u002Fhello')({\n  server: {\n    handlers: {\n      GET: async () => {\n        const req = useRequest()\n        const log = req.context.log as RequestLogger\n\n        log.set({ user: { id: 'user_123', plan: 'pro' } })\n        log.set({ action: 'fetch_profile' })\n        log.set({ cache: { hit: true, ttl: 3600 } })\n\n        return Response.json({ ok: true })\n      },\n    },\n  },\n})\n","src\u002Froutes\u002Fapi\u002Fhello.ts",[436,1014,1015,1034,1053,1076,1080,1106,1114,1123,1141,1157,1184,1188,1243,1271,1315,1320,1349,1355,1361,1366],{"__ignoreMap":524},[528,1016,1017,1019,1021,1024,1026,1028,1030,1032],{"class":530,"line":531},[528,1018,618],{"class":617},[528,1020,622],{"class":621},[528,1022,1023],{"class":625}," createFileRoute",[528,1025,629],{"class":621},[528,1027,632],{"class":617},[528,1029,635],{"class":621},[528,1031,853],{"class":537},[528,1033,641],{"class":621},[528,1035,1036,1038,1040,1043,1045,1047,1049,1051],{"class":530,"line":644},[528,1037,618],{"class":617},[528,1039,622],{"class":621},[528,1041,1042],{"class":625}," useRequest",[528,1044,629],{"class":621},[528,1046,632],{"class":617},[528,1048,635],{"class":621},[528,1050,1007],{"class":537},[528,1052,641],{"class":621},[528,1054,1055,1057,1060,1062,1065,1067,1069,1071,1074],{"class":530,"line":661},[528,1056,618],{"class":617},[528,1058,1059],{"class":617}," type",[528,1061,622],{"class":621},[528,1063,1064],{"class":625}," RequestLogger",[528,1066,629],{"class":621},[528,1068,632],{"class":617},[528,1070,635],{"class":621},[528,1072,1073],{"class":537},"evlog",[528,1075,641],{"class":621},[528,1077,1078],{"class":530,"line":668},[528,1079,665],{"emptyLinePlaceholder":664},[528,1081,1082,1084,1086,1088,1090,1092,1094,1096,1099,1101,1104],{"class":530,"line":686},[528,1083,671],{"class":617},[528,1085,906],{"class":905},[528,1087,909],{"class":625},[528,1089,912],{"class":621},[528,1091,1023],{"class":677},[528,1093,680],{"class":625},[528,1095,760],{"class":621},[528,1097,1098],{"class":537},"\u002Fapi\u002Fhello",[528,1100,760],{"class":621},[528,1102,1103],{"class":625},")(",[528,1105,683],{"class":621},[528,1107,1108,1110,1112],{"class":530,"line":698},[528,1109,923],{"class":689},[528,1111,508],{"class":621},[528,1113,695],{"class":621},[528,1115,1116,1119,1121],{"class":530,"line":713},[528,1117,1118],{"class":689},"    handlers",[528,1120,508],{"class":621},[528,1122,695],{"class":621},[528,1124,1125,1128,1130,1133,1136,1139],{"class":530,"line":719},[528,1126,1127],{"class":677},"      GET",[528,1129,508],{"class":621},[528,1131,1132],{"class":905}," async",[528,1134,1135],{"class":621}," ()",[528,1137,1138],{"class":905}," =>",[528,1140,695],{"class":621},[528,1142,1143,1146,1149,1152,1154],{"class":530,"line":730},[528,1144,1145],{"class":905},"        const",[528,1147,1148],{"class":625}," req",[528,1150,1151],{"class":621}," =",[528,1153,1042],{"class":677},[528,1155,1156],{"class":689},"()\n",[528,1158,1159,1161,1164,1166,1168,1170,1173,1175,1178,1181],{"class":530,"line":740},[528,1160,1145],{"class":905},[528,1162,1163],{"class":625}," log",[528,1165,1151],{"class":621},[528,1167,1148],{"class":625},[528,1169,802],{"class":621},[528,1171,1172],{"class":625},"context",[528,1174,802],{"class":621},[528,1176,1177],{"class":625},"log",[528,1179,1180],{"class":617}," as",[528,1182,1183],{"class":534}," RequestLogger\n",[528,1185,1186],{"class":530,"line":766},[528,1187,665],{"emptyLinePlaceholder":664},[528,1189,1190,1193,1195,1198,1200,1203,1206,1208,1210,1213,1215,1217,1220,1222,1225,1228,1230,1232,1235,1237,1239,1241],{"class":530,"line":777},[528,1191,1192],{"class":625},"        log",[528,1194,802],{"class":621},[528,1196,1197],{"class":677},"set",[528,1199,680],{"class":689},[528,1201,1202],{"class":621},"{",[528,1204,1205],{"class":689}," user",[528,1207,508],{"class":621},[528,1209,622],{"class":621},[528,1211,1212],{"class":689}," id",[528,1214,508],{"class":621},[528,1216,635],{"class":621},[528,1218,1219],{"class":537},"user_123",[528,1221,760],{"class":621},[528,1223,1224],{"class":621},",",[528,1226,1227],{"class":689}," plan",[528,1229,508],{"class":621},[528,1231,635],{"class":621},[528,1233,1234],{"class":537},"pro",[528,1236,760],{"class":621},[528,1238,629],{"class":621},[528,1240,629],{"class":621},[528,1242,791],{"class":689},[528,1244,1245,1247,1249,1251,1253,1255,1258,1260,1262,1265,1267,1269],{"class":530,"line":785},[528,1246,1192],{"class":625},[528,1248,802],{"class":621},[528,1250,1197],{"class":677},[528,1252,680],{"class":689},[528,1254,1202],{"class":621},[528,1256,1257],{"class":689}," action",[528,1259,508],{"class":621},[528,1261,635],{"class":621},[528,1263,1264],{"class":537},"fetch_profile",[528,1266,760],{"class":621},[528,1268,629],{"class":621},[528,1270,791],{"class":689},[528,1272,1274,1276,1278,1280,1282,1284,1287,1289,1291,1294,1296,1298,1300,1303,1305,1309,1311,1313],{"class":530,"line":1273},14,[528,1275,1192],{"class":625},[528,1277,802],{"class":621},[528,1279,1197],{"class":677},[528,1281,680],{"class":689},[528,1283,1202],{"class":621},[528,1285,1286],{"class":689}," cache",[528,1288,508],{"class":621},[528,1290,622],{"class":621},[528,1292,1293],{"class":689}," hit",[528,1295,508],{"class":621},[528,1297,707],{"class":706},[528,1299,1224],{"class":621},[528,1301,1302],{"class":689}," ttl",[528,1304,508],{"class":621},[528,1306,1308],{"class":1307},"sbssI"," 3600",[528,1310,629],{"class":621},[528,1312,629],{"class":621},[528,1314,791],{"class":689},[528,1316,1318],{"class":530,"line":1317},15,[528,1319,665],{"emptyLinePlaceholder":664},[528,1321,1323,1326,1329,1331,1334,1336,1338,1341,1343,1345,1347],{"class":530,"line":1322},16,[528,1324,1325],{"class":617},"        return",[528,1327,1328],{"class":625}," Response",[528,1330,802],{"class":621},[528,1332,1333],{"class":677},"json",[528,1335,680],{"class":689},[528,1337,1202],{"class":621},[528,1339,1340],{"class":689}," ok",[528,1342,508],{"class":621},[528,1344,707],{"class":706},[528,1346,629],{"class":621},[528,1348,791],{"class":689},[528,1350,1352],{"class":530,"line":1351},17,[528,1353,1354],{"class":621},"      },\n",[528,1356,1358],{"class":530,"line":1357},18,[528,1359,1360],{"class":621},"    },\n",[528,1362,1364],{"class":530,"line":1363},19,[528,1365,716],{"class":621},[528,1367,1369,1371],{"class":530,"line":1368},20,[528,1370,788],{"class":621},[528,1372,791],{"class":625},[427,1374,1375],{},"All fields are merged into a single wide event emitted when the request completes:",[518,1377,1380],{"className":520,"code":1378,"filename":1379,"language":523,"meta":524,"style":524},"14:58:15 INFO [my-app] GET \u002Fapi\u002Fhello 200 in 52ms\n  ├─ cache: hit=true ttl=3600\n  ├─ action: fetch_profile\n  ├─ user: id=user_123 plan=pro\n  └─ requestId: 4a8ff3a8-...\n","Terminal output",[436,1381,1382,1393,1413,1423,1436],{"__ignoreMap":524},[528,1383,1384,1387,1390],{"class":530,"line":531},[528,1385,1386],{"class":534},"14:58:15",[528,1388,1389],{"class":537}," INFO",[528,1391,1392],{"class":625}," [my-app] GET \u002Fapi\u002Fhello 200 in 52ms\n",[528,1394,1395,1398,1401,1404,1407,1410],{"class":530,"line":644},[528,1396,1397],{"class":534},"  ├─",[528,1399,1400],{"class":537}," cache:",[528,1402,1403],{"class":537}," hit=",[528,1405,1406],{"class":621},"true",[528,1408,1409],{"class":537}," ttl=",[528,1411,1412],{"class":1307},"3600\n",[528,1414,1415,1417,1420],{"class":530,"line":661},[528,1416,1397],{"class":534},[528,1418,1419],{"class":537}," action:",[528,1421,1422],{"class":537}," fetch_profile\n",[528,1424,1425,1427,1430,1433],{"class":530,"line":668},[528,1426,1397],{"class":534},[528,1428,1429],{"class":537}," user:",[528,1431,1432],{"class":537}," id=user_123",[528,1434,1435],{"class":537}," plan=pro\n",[528,1437,1438,1441,1444],{"class":530,"line":686},[528,1439,1440],{"class":534},"  └─",[528,1442,1443],{"class":537}," requestId:",[528,1445,1446],{"class":537}," 4a8ff3a8-...\n",[441,1448,1449,1451,1452,1455],{"color":443,"icon":13},[436,1450,801],{}," is an experimental Nitro v3 feature powered by ",[436,1453,1454],{},"AsyncLocalStorage",". It works on Node.js and Bun runtimes.",[499,1457,1459],{"id":1458},"error-handling","Error Handling",[427,1461,1462,1463,1466,1467,817,1469,821,1471,1473],{},"Use ",[436,1464,1465],{},"createError"," for structured errors with ",[436,1468,816],{},[436,1470,820],{},[436,1472,824],{}," fields:",[518,1475,1478],{"className":608,"code":1476,"filename":1477,"language":610,"meta":524,"style":524},"import { createFileRoute } from '@tanstack\u002Freact-router'\nimport { useRequest } from 'nitro\u002Fcontext'\nimport { createError } from 'evlog'\nimport type { RequestLogger } from 'evlog'\n\nexport const Route = createFileRoute('\u002Fapi\u002Fcheckout')({\n  server: {\n    handlers: {\n      POST: async ({ request }) => {\n        const req = useRequest()\n        const log = req.context.log as RequestLogger\n        const body = await request.json()\n\n        log.set({ user: { id: body.userId, plan: body.plan } })\n        log.set({ cart: { items: body.items, total: body.total } })\n\n        const result = await chargeCard(body)\n\n        if (!result.success) {\n          throw createError({\n            message: 'Payment failed',\n            status: 402,\n            why: 'Card declined by issuer',\n            fix: 'Try a different payment method',\n            link: 'https:\u002F\u002Fdocs.example.com\u002Fpayments\u002Fdeclined',\n          })\n        }\n\n        return Response.json({ success: true, orderId: result.orderId })\n      },\n    },\n  },\n})\n","src\u002Froutes\u002Fapi\u002Fcheckout.ts",[436,1479,1480,1498,1516,1535,1555,1559,1584,1592,1600,1623,1635,1657,1677,1681,1729,1780,1784,1805,1809,1833,1844,1861,1874,1891,1908,1925,1933,1939,1944,1984,1989,1994,1999],{"__ignoreMap":524},[528,1481,1482,1484,1486,1488,1490,1492,1494,1496],{"class":530,"line":531},[528,1483,618],{"class":617},[528,1485,622],{"class":621},[528,1487,1023],{"class":625},[528,1489,629],{"class":621},[528,1491,632],{"class":617},[528,1493,635],{"class":621},[528,1495,853],{"class":537},[528,1497,641],{"class":621},[528,1499,1500,1502,1504,1506,1508,1510,1512,1514],{"class":530,"line":644},[528,1501,618],{"class":617},[528,1503,622],{"class":621},[528,1505,1042],{"class":625},[528,1507,629],{"class":621},[528,1509,632],{"class":617},[528,1511,635],{"class":621},[528,1513,1007],{"class":537},[528,1515,641],{"class":621},[528,1517,1518,1520,1522,1525,1527,1529,1531,1533],{"class":530,"line":661},[528,1519,618],{"class":617},[528,1521,622],{"class":621},[528,1523,1524],{"class":625}," createError",[528,1526,629],{"class":621},[528,1528,632],{"class":617},[528,1530,635],{"class":621},[528,1532,1073],{"class":537},[528,1534,641],{"class":621},[528,1536,1537,1539,1541,1543,1545,1547,1549,1551,1553],{"class":530,"line":668},[528,1538,618],{"class":617},[528,1540,1059],{"class":617},[528,1542,622],{"class":621},[528,1544,1064],{"class":625},[528,1546,629],{"class":621},[528,1548,632],{"class":617},[528,1550,635],{"class":621},[528,1552,1073],{"class":537},[528,1554,641],{"class":621},[528,1556,1557],{"class":530,"line":686},[528,1558,665],{"emptyLinePlaceholder":664},[528,1560,1561,1563,1565,1567,1569,1571,1573,1575,1578,1580,1582],{"class":530,"line":698},[528,1562,671],{"class":617},[528,1564,906],{"class":905},[528,1566,909],{"class":625},[528,1568,912],{"class":621},[528,1570,1023],{"class":677},[528,1572,680],{"class":625},[528,1574,760],{"class":621},[528,1576,1577],{"class":537},"\u002Fapi\u002Fcheckout",[528,1579,760],{"class":621},[528,1581,1103],{"class":625},[528,1583,683],{"class":621},[528,1585,1586,1588,1590],{"class":530,"line":713},[528,1587,923],{"class":689},[528,1589,508],{"class":621},[528,1591,695],{"class":621},[528,1593,1594,1596,1598],{"class":530,"line":719},[528,1595,1118],{"class":689},[528,1597,508],{"class":621},[528,1599,695],{"class":621},[528,1601,1602,1605,1607,1609,1612,1616,1619,1621],{"class":530,"line":730},[528,1603,1604],{"class":677},"      POST",[528,1606,508],{"class":621},[528,1608,1132],{"class":905},[528,1610,1611],{"class":621}," ({",[528,1613,1615],{"class":1614},"sHdIc"," request",[528,1617,1618],{"class":621}," })",[528,1620,1138],{"class":905},[528,1622,695],{"class":621},[528,1624,1625,1627,1629,1631,1633],{"class":530,"line":740},[528,1626,1145],{"class":905},[528,1628,1148],{"class":625},[528,1630,1151],{"class":621},[528,1632,1042],{"class":677},[528,1634,1156],{"class":689},[528,1636,1637,1639,1641,1643,1645,1647,1649,1651,1653,1655],{"class":530,"line":766},[528,1638,1145],{"class":905},[528,1640,1163],{"class":625},[528,1642,1151],{"class":621},[528,1644,1148],{"class":625},[528,1646,802],{"class":621},[528,1648,1172],{"class":625},[528,1650,802],{"class":621},[528,1652,1177],{"class":625},[528,1654,1180],{"class":617},[528,1656,1183],{"class":534},[528,1658,1659,1661,1664,1666,1669,1671,1673,1675],{"class":530,"line":777},[528,1660,1145],{"class":905},[528,1662,1663],{"class":625}," body",[528,1665,1151],{"class":621},[528,1667,1668],{"class":617}," await",[528,1670,1615],{"class":625},[528,1672,802],{"class":621},[528,1674,1333],{"class":677},[528,1676,1156],{"class":689},[528,1678,1679],{"class":530,"line":785},[528,1680,665],{"emptyLinePlaceholder":664},[528,1682,1683,1685,1687,1689,1691,1693,1695,1697,1699,1701,1703,1705,1707,1710,1712,1714,1716,1718,1720,1723,1725,1727],{"class":530,"line":1273},[528,1684,1192],{"class":625},[528,1686,802],{"class":621},[528,1688,1197],{"class":677},[528,1690,680],{"class":689},[528,1692,1202],{"class":621},[528,1694,1205],{"class":689},[528,1696,508],{"class":621},[528,1698,622],{"class":621},[528,1700,1212],{"class":689},[528,1702,508],{"class":621},[528,1704,1663],{"class":625},[528,1706,802],{"class":621},[528,1708,1709],{"class":625},"userId",[528,1711,1224],{"class":621},[528,1713,1227],{"class":689},[528,1715,508],{"class":621},[528,1717,1663],{"class":625},[528,1719,802],{"class":621},[528,1721,1722],{"class":625},"plan",[528,1724,629],{"class":621},[528,1726,629],{"class":621},[528,1728,791],{"class":689},[528,1730,1731,1733,1735,1737,1739,1741,1744,1746,1748,1751,1753,1755,1757,1760,1762,1765,1767,1769,1771,1774,1776,1778],{"class":530,"line":1317},[528,1732,1192],{"class":625},[528,1734,802],{"class":621},[528,1736,1197],{"class":677},[528,1738,680],{"class":689},[528,1740,1202],{"class":621},[528,1742,1743],{"class":689}," cart",[528,1745,508],{"class":621},[528,1747,622],{"class":621},[528,1749,1750],{"class":689}," items",[528,1752,508],{"class":621},[528,1754,1663],{"class":625},[528,1756,802],{"class":621},[528,1758,1759],{"class":625},"items",[528,1761,1224],{"class":621},[528,1763,1764],{"class":689}," total",[528,1766,508],{"class":621},[528,1768,1663],{"class":625},[528,1770,802],{"class":621},[528,1772,1773],{"class":625},"total",[528,1775,629],{"class":621},[528,1777,629],{"class":621},[528,1779,791],{"class":689},[528,1781,1782],{"class":530,"line":1322},[528,1783,665],{"emptyLinePlaceholder":664},[528,1785,1786,1788,1791,1793,1795,1798,1800,1803],{"class":530,"line":1351},[528,1787,1145],{"class":905},[528,1789,1790],{"class":625}," result",[528,1792,1151],{"class":621},[528,1794,1668],{"class":617},[528,1796,1797],{"class":677}," chargeCard",[528,1799,680],{"class":689},[528,1801,1802],{"class":625},"body",[528,1804,791],{"class":689},[528,1806,1807],{"class":530,"line":1357},[528,1808,665],{"emptyLinePlaceholder":664},[528,1810,1811,1814,1817,1820,1823,1825,1828,1831],{"class":530,"line":1363},[528,1812,1813],{"class":617},"        if",[528,1815,1816],{"class":689}," (",[528,1818,1819],{"class":621},"!",[528,1821,1822],{"class":625},"result",[528,1824,802],{"class":621},[528,1826,1827],{"class":625},"success",[528,1829,1830],{"class":689},") ",[528,1832,683],{"class":621},[528,1834,1835,1838,1840,1842],{"class":530,"line":1368},[528,1836,1837],{"class":617},"          throw",[528,1839,1524],{"class":677},[528,1841,680],{"class":689},[528,1843,683],{"class":621},[528,1845,1847,1850,1852,1854,1857,1859],{"class":530,"line":1846},21,[528,1848,1849],{"class":689},"            message",[528,1851,508],{"class":621},[528,1853,635],{"class":621},[528,1855,1856],{"class":537},"Payment failed",[528,1858,760],{"class":621},[528,1860,710],{"class":621},[528,1862,1864,1867,1869,1872],{"class":530,"line":1863},22,[528,1865,1866],{"class":689},"            status",[528,1868,508],{"class":621},[528,1870,1871],{"class":1307}," 402",[528,1873,710],{"class":621},[528,1875,1877,1880,1882,1884,1887,1889],{"class":530,"line":1876},23,[528,1878,1879],{"class":689},"            why",[528,1881,508],{"class":621},[528,1883,635],{"class":621},[528,1885,1886],{"class":537},"Card declined by issuer",[528,1888,760],{"class":621},[528,1890,710],{"class":621},[528,1892,1894,1897,1899,1901,1904,1906],{"class":530,"line":1893},24,[528,1895,1896],{"class":689},"            fix",[528,1898,508],{"class":621},[528,1900,635],{"class":621},[528,1902,1903],{"class":537},"Try a different payment method",[528,1905,760],{"class":621},[528,1907,710],{"class":621},[528,1909,1911,1914,1916,1918,1921,1923],{"class":530,"line":1910},25,[528,1912,1913],{"class":689},"            link",[528,1915,508],{"class":621},[528,1917,635],{"class":621},[528,1919,1920],{"class":537},"https:\u002F\u002Fdocs.example.com\u002Fpayments\u002Fdeclined",[528,1922,760],{"class":621},[528,1924,710],{"class":621},[528,1926,1928,1931],{"class":530,"line":1927},26,[528,1929,1930],{"class":621},"          }",[528,1932,791],{"class":689},[528,1934,1936],{"class":530,"line":1935},27,[528,1937,1938],{"class":621},"        }\n",[528,1940,1942],{"class":530,"line":1941},28,[528,1943,665],{"emptyLinePlaceholder":664},[528,1945,1947,1949,1951,1953,1955,1957,1959,1962,1964,1966,1968,1971,1973,1975,1977,1980,1982],{"class":530,"line":1946},29,[528,1948,1325],{"class":617},[528,1950,1328],{"class":625},[528,1952,802],{"class":621},[528,1954,1333],{"class":677},[528,1956,680],{"class":689},[528,1958,1202],{"class":621},[528,1960,1961],{"class":689}," success",[528,1963,508],{"class":621},[528,1965,707],{"class":706},[528,1967,1224],{"class":621},[528,1969,1970],{"class":689}," orderId",[528,1972,508],{"class":621},[528,1974,1790],{"class":625},[528,1976,802],{"class":621},[528,1978,1979],{"class":625},"orderId",[528,1981,629],{"class":621},[528,1983,791],{"class":689},[528,1985,1987],{"class":530,"line":1986},30,[528,1988,1354],{"class":621},[528,1990,1992],{"class":530,"line":1991},31,[528,1993,1360],{"class":621},[528,1995,1997],{"class":530,"line":1996},32,[528,1998,716],{"class":621},[528,2000,2002,2004],{"class":530,"line":2001},33,[528,2003,788],{"class":621},[528,2005,791],{"class":625},[427,2007,2008],{},"The error is captured and logged with both the custom context and structured error fields:",[518,2010,2012],{"className":520,"code":2011,"filename":1379,"language":523,"meta":524,"style":524},"14:58:20 ERROR [my-app] POST \u002Fapi\u002Fcheckout 402 in 104ms\n  ├─ error: name=EvlogError message=Payment failed status=402\n  ├─ cart: items=3 total=9999\n  ├─ user: id=user_123 plan=pro\n  └─ requestId: 880a50ac-...\n",[436,2013,2014,2025,2047,2066,2076],{"__ignoreMap":524},[528,2015,2016,2019,2022],{"class":530,"line":531},[528,2017,2018],{"class":534},"14:58:20",[528,2020,2021],{"class":537}," ERROR",[528,2023,2024],{"class":625}," [my-app] POST \u002Fapi\u002Fcheckout 402 in 104ms\n",[528,2026,2027,2029,2032,2035,2038,2041,2044],{"class":530,"line":644},[528,2028,1397],{"class":534},[528,2030,2031],{"class":537}," error:",[528,2033,2034],{"class":537}," name=EvlogError",[528,2036,2037],{"class":537}," message=Payment",[528,2039,2040],{"class":537}," failed",[528,2042,2043],{"class":537}," status=",[528,2045,2046],{"class":1307},"402\n",[528,2048,2049,2051,2054,2057,2060,2063],{"class":530,"line":661},[528,2050,1397],{"class":534},[528,2052,2053],{"class":537}," cart:",[528,2055,2056],{"class":537}," items=",[528,2058,2059],{"class":1307},"3",[528,2061,2062],{"class":537}," total=",[528,2064,2065],{"class":1307},"9999\n",[528,2067,2068,2070,2072,2074],{"class":530,"line":668},[528,2069,1397],{"class":534},[528,2071,1429],{"class":537},[528,2073,1432],{"class":537},[528,2075,1435],{"class":537},[528,2077,2078,2080,2082],{"class":530,"line":686},[528,2079,1440],{"class":534},[528,2081,1443],{"class":537},[528,2083,2084],{"class":537}," 880a50ac-...\n",[510,2086,2088],{"id":2087},"parsing-errors-on-the-client","Parsing Errors on the Client",[427,2090,1462,2091,2094],{},[436,2092,2093],{},"parseError"," to extract the structured fields from any error response:",[518,2096,2101],{"className":2097,"code":2098,"filename":2099,"language":2100,"meta":524,"style":524},"language-tsx shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { parseError } from 'evlog'\n\ntry {\n  const res = await fetch('\u002Fapi\u002Fcheckout', {\n    method: 'POST',\n    body: JSON.stringify({ userId: 'user_123' }),\n  })\n  if (!res.ok) throw { data: await res.json(), status: res.status }\n} catch (error) {\n  const { message, status, why, fix, link } = parseError(error)\n}\n","src\u002Froutes\u002Fcheckout.tsx","tsx",[436,2102,2103,2122,2126,2133,2160,2176,2212,2219,2275,2287,2328],{"__ignoreMap":524},[528,2104,2105,2107,2109,2112,2114,2116,2118,2120],{"class":530,"line":531},[528,2106,618],{"class":617},[528,2108,622],{"class":621},[528,2110,2111],{"class":625}," parseError",[528,2113,629],{"class":621},[528,2115,632],{"class":617},[528,2117,635],{"class":621},[528,2119,1073],{"class":537},[528,2121,641],{"class":621},[528,2123,2124],{"class":530,"line":644},[528,2125,665],{"emptyLinePlaceholder":664},[528,2127,2128,2131],{"class":530,"line":661},[528,2129,2130],{"class":617},"try",[528,2132,695],{"class":621},[528,2134,2135,2138,2141,2143,2145,2148,2150,2152,2154,2156,2158],{"class":530,"line":668},[528,2136,2137],{"class":905},"  const",[528,2139,2140],{"class":625}," res",[528,2142,1151],{"class":621},[528,2144,1668],{"class":617},[528,2146,2147],{"class":677}," fetch",[528,2149,680],{"class":689},[528,2151,760],{"class":621},[528,2153,1577],{"class":537},[528,2155,760],{"class":621},[528,2157,1224],{"class":621},[528,2159,695],{"class":621},[528,2161,2162,2165,2167,2169,2172,2174],{"class":530,"line":686},[528,2163,2164],{"class":689},"    method",[528,2166,508],{"class":621},[528,2168,635],{"class":621},[528,2170,2171],{"class":537},"POST",[528,2173,760],{"class":621},[528,2175,710],{"class":621},[528,2177,2178,2181,2183,2186,2188,2191,2193,2195,2198,2200,2202,2204,2206,2208,2210],{"class":530,"line":698},[528,2179,2180],{"class":689},"    body",[528,2182,508],{"class":621},[528,2184,2185],{"class":625}," JSON",[528,2187,802],{"class":621},[528,2189,2190],{"class":677},"stringify",[528,2192,680],{"class":689},[528,2194,1202],{"class":621},[528,2196,2197],{"class":689}," userId",[528,2199,508],{"class":621},[528,2201,635],{"class":621},[528,2203,1219],{"class":537},[528,2205,760],{"class":621},[528,2207,629],{"class":621},[528,2209,772],{"class":689},[528,2211,710],{"class":621},[528,2213,2214,2217],{"class":530,"line":713},[528,2215,2216],{"class":621},"  }",[528,2218,791],{"class":689},[528,2220,2221,2224,2226,2228,2231,2233,2236,2238,2241,2243,2246,2248,2250,2252,2254,2256,2258,2260,2263,2265,2267,2269,2272],{"class":530,"line":719},[528,2222,2223],{"class":617},"  if",[528,2225,1816],{"class":689},[528,2227,1819],{"class":621},[528,2229,2230],{"class":625},"res",[528,2232,802],{"class":621},[528,2234,2235],{"class":625},"ok",[528,2237,1830],{"class":689},[528,2239,2240],{"class":617},"throw",[528,2242,622],{"class":621},[528,2244,2245],{"class":689}," data",[528,2247,508],{"class":621},[528,2249,1668],{"class":617},[528,2251,2140],{"class":625},[528,2253,802],{"class":621},[528,2255,1333],{"class":677},[528,2257,943],{"class":689},[528,2259,1224],{"class":621},[528,2261,2262],{"class":689}," status",[528,2264,508],{"class":621},[528,2266,2140],{"class":625},[528,2268,802],{"class":621},[528,2270,2271],{"class":625},"status",[528,2273,2274],{"class":621}," }\n",[528,2276,2277,2279,2282,2285],{"class":530,"line":730},[528,2278,788],{"class":621},[528,2280,2281],{"class":617}," catch",[528,2283,2284],{"class":625}," (error) ",[528,2286,683],{"class":621},[528,2288,2289,2291,2293,2296,2298,2300,2302,2305,2307,2310,2312,2315,2317,2319,2321,2323,2326],{"class":530,"line":740},[528,2290,2137],{"class":905},[528,2292,622],{"class":621},[528,2294,2295],{"class":625}," message",[528,2297,1224],{"class":621},[528,2299,2262],{"class":625},[528,2301,1224],{"class":621},[528,2303,2304],{"class":625}," why",[528,2306,1224],{"class":621},[528,2308,2309],{"class":625}," fix",[528,2311,1224],{"class":621},[528,2313,2314],{"class":625}," link",[528,2316,629],{"class":621},[528,2318,1151],{"class":621},[528,2320,2111],{"class":677},[528,2322,680],{"class":689},[528,2324,2325],{"class":625},"error",[528,2327,791],{"class":689},[528,2329,2330],{"class":530,"line":766},[528,2331,2332],{"class":621},"}\n",[499,2334,170],{"id":2335},"configuration",[427,2337,2338,2339,2342,2343,2346],{},"See the ",[431,2340,2341],{"href":171},"Configuration reference"," for all available options (",[436,2344,2345],{},"initLogger",", middleware options, sampling, silent mode, etc.).",[499,2348,2350],{"id":2349},"route-filtering","Route Filtering",[427,2352,2353,2354,2357,2358,2361],{},"Control which routes are logged with ",[436,2355,2356],{},"include"," and ",[436,2359,2360],{},"exclude"," in the module options:",[518,2363,2365],{"className":608,"code":2364,"filename":591,"language":610,"meta":524,"style":524},"import { defineConfig } from 'nitro'\nimport evlog from 'evlog\u002Fnitro\u002Fv3'\n\nexport default defineConfig({\n  experimental: { asyncContext: true },\n  modules: [\n    evlog({\n      env: { service: 'my-app' },\n      include: ['\u002Fapi\u002F**'],\n      exclude: ['\u002F_internal\u002F**', '\u002Fhealth'],\n      routes: {\n        '\u002Fapi\u002Fauth\u002F**': { service: 'auth-service' },\n        '\u002Fapi\u002Fpayment\u002F**': { service: 'payment-service' },\n      },\n    }),\n  ],\n})\n",[436,2366,2367,2385,2399,2403,2415,2432,2440,2448,2468,2489,2518,2527,2554,2580,2584,2592,2598],{"__ignoreMap":524},[528,2368,2369,2371,2373,2375,2377,2379,2381,2383],{"class":530,"line":531},[528,2370,618],{"class":617},[528,2372,622],{"class":621},[528,2374,626],{"class":625},[528,2376,629],{"class":621},[528,2378,632],{"class":617},[528,2380,635],{"class":621},[528,2382,638],{"class":537},[528,2384,641],{"class":621},[528,2386,2387,2389,2391,2393,2395,2397],{"class":530,"line":644},[528,2388,618],{"class":617},[528,2390,649],{"class":625},[528,2392,652],{"class":617},[528,2394,635],{"class":621},[528,2396,438],{"class":537},[528,2398,641],{"class":621},[528,2400,2401],{"class":530,"line":661},[528,2402,665],{"emptyLinePlaceholder":664},[528,2404,2405,2407,2409,2411,2413],{"class":530,"line":668},[528,2406,671],{"class":617},[528,2408,674],{"class":617},[528,2410,626],{"class":677},[528,2412,680],{"class":625},[528,2414,683],{"class":621},[528,2416,2417,2419,2421,2423,2426,2428,2430],{"class":530,"line":686},[528,2418,690],{"class":689},[528,2420,508],{"class":621},[528,2422,622],{"class":621},[528,2424,2425],{"class":689}," asyncContext",[528,2427,508],{"class":621},[528,2429,707],{"class":706},[528,2431,763],{"class":621},[528,2433,2434,2436,2438],{"class":530,"line":698},[528,2435,722],{"class":689},[528,2437,508],{"class":621},[528,2439,727],{"class":625},[528,2441,2442,2444,2446],{"class":530,"line":713},[528,2443,733],{"class":677},[528,2445,680],{"class":625},[528,2447,683],{"class":621},[528,2449,2450,2452,2454,2456,2458,2460,2462,2464,2466],{"class":530,"line":719},[528,2451,743],{"class":689},[528,2453,508],{"class":621},[528,2455,622],{"class":621},[528,2457,750],{"class":689},[528,2459,508],{"class":621},[528,2461,635],{"class":621},[528,2463,757],{"class":537},[528,2465,760],{"class":621},[528,2467,763],{"class":621},[528,2469,2470,2473,2475,2477,2479,2482,2484,2487],{"class":530,"line":730},[528,2471,2472],{"class":689},"      include",[528,2474,508],{"class":621},[528,2476,937],{"class":625},[528,2478,760],{"class":621},[528,2480,2481],{"class":537},"\u002Fapi\u002F**",[528,2483,760],{"class":621},[528,2485,2486],{"class":625},"]",[528,2488,710],{"class":621},[528,2490,2491,2494,2496,2498,2500,2503,2505,2507,2509,2512,2514,2516],{"class":530,"line":740},[528,2492,2493],{"class":689},"      exclude",[528,2495,508],{"class":621},[528,2497,937],{"class":625},[528,2499,760],{"class":621},[528,2501,2502],{"class":537},"\u002F_internal\u002F**",[528,2504,760],{"class":621},[528,2506,1224],{"class":621},[528,2508,635],{"class":621},[528,2510,2511],{"class":537},"\u002Fhealth",[528,2513,760],{"class":621},[528,2515,2486],{"class":625},[528,2517,710],{"class":621},[528,2519,2520,2523,2525],{"class":530,"line":766},[528,2521,2522],{"class":689},"      routes",[528,2524,508],{"class":621},[528,2526,695],{"class":621},[528,2528,2529,2532,2535,2537,2539,2541,2543,2545,2547,2550,2552],{"class":530,"line":777},[528,2530,2531],{"class":621},"        '",[528,2533,2534],{"class":689},"\u002Fapi\u002Fauth\u002F**",[528,2536,760],{"class":621},[528,2538,508],{"class":621},[528,2540,622],{"class":621},[528,2542,750],{"class":689},[528,2544,508],{"class":621},[528,2546,635],{"class":621},[528,2548,2549],{"class":537},"auth-service",[528,2551,760],{"class":621},[528,2553,763],{"class":621},[528,2555,2556,2558,2561,2563,2565,2567,2569,2571,2573,2576,2578],{"class":530,"line":785},[528,2557,2531],{"class":621},[528,2559,2560],{"class":689},"\u002Fapi\u002Fpayment\u002F**",[528,2562,760],{"class":621},[528,2564,508],{"class":621},[528,2566,622],{"class":621},[528,2568,750],{"class":689},[528,2570,508],{"class":621},[528,2572,635],{"class":621},[528,2574,2575],{"class":537},"payment-service",[528,2577,760],{"class":621},[528,2579,763],{"class":621},[528,2581,2582],{"class":530,"line":1273},[528,2583,1354],{"class":621},[528,2585,2586,2588,2590],{"class":530,"line":1317},[528,2587,769],{"class":621},[528,2589,772],{"class":625},[528,2591,710],{"class":621},[528,2593,2594,2596],{"class":530,"line":1322},[528,2595,780],{"class":625},[528,2597,710],{"class":621},[528,2599,2600,2602],{"class":530,"line":1351},[528,2601,788],{"class":621},[528,2603,791],{"class":625},[499,2605,2607],{"id":2606},"drain-enrichers","Drain & Enrichers",[427,2609,2610,2611,2614],{},"Since TanStack Start uses Nitro v3, configure drains and enrichers via Nitro plugins. Create a ",[436,2612,2613],{},"server\u002Fplugins\u002F"," directory and register hooks:",[518,2616,2619],{"className":608,"code":2617,"filename":2618,"language":610,"meta":524,"style":524},"import { definePlugin } from 'nitro'\nimport { createAxiomDrain } from 'evlog\u002Faxiom'\n\nexport default definePlugin((nitroApp) => {\n  const axiom = createAxiomDrain()\n\n  nitroApp.hooks.hook('evlog:drain', axiom)\n})\n","server\u002Fplugins\u002Fevlog-drain.ts",[436,2620,2621,2640,2660,2664,2685,2698,2702,2732],{"__ignoreMap":524},[528,2622,2623,2625,2627,2630,2632,2634,2636,2638],{"class":530,"line":531},[528,2624,618],{"class":617},[528,2626,622],{"class":621},[528,2628,2629],{"class":625}," definePlugin",[528,2631,629],{"class":621},[528,2633,632],{"class":617},[528,2635,635],{"class":621},[528,2637,638],{"class":537},[528,2639,641],{"class":621},[528,2641,2642,2644,2646,2649,2651,2653,2655,2658],{"class":530,"line":644},[528,2643,618],{"class":617},[528,2645,622],{"class":621},[528,2647,2648],{"class":625}," createAxiomDrain",[528,2650,629],{"class":621},[528,2652,632],{"class":617},[528,2654,635],{"class":621},[528,2656,2657],{"class":537},"evlog\u002Faxiom",[528,2659,641],{"class":621},[528,2661,2662],{"class":530,"line":661},[528,2663,665],{"emptyLinePlaceholder":664},[528,2665,2666,2668,2670,2672,2674,2676,2679,2681,2683],{"class":530,"line":668},[528,2667,671],{"class":617},[528,2669,674],{"class":617},[528,2671,2629],{"class":677},[528,2673,680],{"class":625},[528,2675,680],{"class":621},[528,2677,2678],{"class":1614},"nitroApp",[528,2680,772],{"class":621},[528,2682,1138],{"class":905},[528,2684,695],{"class":621},[528,2686,2687,2689,2692,2694,2696],{"class":530,"line":686},[528,2688,2137],{"class":905},[528,2690,2691],{"class":625}," axiom",[528,2693,1151],{"class":621},[528,2695,2648],{"class":677},[528,2697,1156],{"class":689},[528,2699,2700],{"class":530,"line":698},[528,2701,665],{"emptyLinePlaceholder":664},[528,2703,2704,2707,2709,2712,2714,2717,2719,2721,2724,2726,2728,2730],{"class":530,"line":713},[528,2705,2706],{"class":625},"  nitroApp",[528,2708,802],{"class":621},[528,2710,2711],{"class":625},"hooks",[528,2713,802],{"class":621},[528,2715,2716],{"class":677},"hook",[528,2718,680],{"class":689},[528,2720,760],{"class":621},[528,2722,2723],{"class":537},"evlog:drain",[528,2725,760],{"class":621},[528,2727,1224],{"class":621},[528,2729,2691],{"class":625},[528,2731,791],{"class":689},[528,2733,2734,2736],{"class":530,"line":719},[528,2735,788],{"class":621},[528,2737,791],{"class":625},[518,2739,2742],{"className":608,"code":2740,"filename":2741,"language":610,"meta":524,"style":524},"import { definePlugin } from 'nitro'\nimport { createUserAgentEnricher, createRequestSizeEnricher } from 'evlog\u002Fenrichers'\n\nexport default definePlugin((nitroApp) => {\n  const enrichers = [createUserAgentEnricher(), createRequestSizeEnricher()]\n\n  nitroApp.hooks.hook('evlog:enrich', (ctx) => {\n    for (const enricher of enrichers) enricher(ctx)\n  })\n})\n","server\u002Fplugins\u002Fevlog-enrich.ts",[436,2743,2744,2762,2787,2791,2811,2834,2838,2872,2901,2907],{"__ignoreMap":524},[528,2745,2746,2748,2750,2752,2754,2756,2758,2760],{"class":530,"line":531},[528,2747,618],{"class":617},[528,2749,622],{"class":621},[528,2751,2629],{"class":625},[528,2753,629],{"class":621},[528,2755,632],{"class":617},[528,2757,635],{"class":621},[528,2759,638],{"class":537},[528,2761,641],{"class":621},[528,2763,2764,2766,2768,2771,2773,2776,2778,2780,2782,2785],{"class":530,"line":644},[528,2765,618],{"class":617},[528,2767,622],{"class":621},[528,2769,2770],{"class":625}," createUserAgentEnricher",[528,2772,1224],{"class":621},[528,2774,2775],{"class":625}," createRequestSizeEnricher",[528,2777,629],{"class":621},[528,2779,632],{"class":617},[528,2781,635],{"class":621},[528,2783,2784],{"class":537},"evlog\u002Fenrichers",[528,2786,641],{"class":621},[528,2788,2789],{"class":530,"line":661},[528,2790,665],{"emptyLinePlaceholder":664},[528,2792,2793,2795,2797,2799,2801,2803,2805,2807,2809],{"class":530,"line":668},[528,2794,671],{"class":617},[528,2796,674],{"class":617},[528,2798,2629],{"class":677},[528,2800,680],{"class":625},[528,2802,680],{"class":621},[528,2804,2678],{"class":1614},[528,2806,772],{"class":621},[528,2808,1138],{"class":905},[528,2810,695],{"class":621},[528,2812,2813,2815,2818,2820,2822,2825,2827,2829,2831],{"class":530,"line":686},[528,2814,2137],{"class":905},[528,2816,2817],{"class":625}," enrichers",[528,2819,1151],{"class":621},[528,2821,937],{"class":689},[528,2823,2824],{"class":677},"createUserAgentEnricher",[528,2826,943],{"class":689},[528,2828,1224],{"class":621},[528,2830,2775],{"class":677},[528,2832,2833],{"class":689},"()]\n",[528,2835,2836],{"class":530,"line":698},[528,2837,665],{"emptyLinePlaceholder":664},[528,2839,2840,2842,2844,2846,2848,2850,2852,2854,2857,2859,2861,2863,2866,2868,2870],{"class":530,"line":713},[528,2841,2706],{"class":625},[528,2843,802],{"class":621},[528,2845,2711],{"class":625},[528,2847,802],{"class":621},[528,2849,2716],{"class":677},[528,2851,680],{"class":689},[528,2853,760],{"class":621},[528,2855,2856],{"class":537},"evlog:enrich",[528,2858,760],{"class":621},[528,2860,1224],{"class":621},[528,2862,1816],{"class":621},[528,2864,2865],{"class":1614},"ctx",[528,2867,772],{"class":621},[528,2869,1138],{"class":905},[528,2871,695],{"class":621},[528,2873,2874,2877,2879,2882,2885,2888,2890,2892,2895,2897,2899],{"class":530,"line":719},[528,2875,2876],{"class":617},"    for",[528,2878,1816],{"class":689},[528,2880,2881],{"class":905},"const",[528,2883,2884],{"class":625}," enricher",[528,2886,2887],{"class":621}," of",[528,2889,2817],{"class":625},[528,2891,1830],{"class":689},[528,2893,2894],{"class":677},"enricher",[528,2896,680],{"class":689},[528,2898,2865],{"class":625},[528,2900,791],{"class":689},[528,2902,2903,2905],{"class":530,"line":730},[528,2904,2216],{"class":621},[528,2906,791],{"class":689},[528,2908,2909,2911],{"class":530,"line":740},[528,2910,788],{"class":621},[528,2912,791],{"class":625},[441,2914,2338,2915,2357,2917,2919],{"color":443,"icon":13},[431,2916,319],{"href":324},[431,2918,406],{"href":411}," docs for all available drain adapters and enrichers.",[510,2921,2923],{"id":2922},"pipeline-batching-retry","Pipeline (Batching & Retry)",[427,2925,2926,2927,2930],{},"For production, wrap your adapter with ",[436,2928,2929],{},"createDrainPipeline"," to batch events and retry on failure:",[518,2932,2934],{"className":608,"code":2933,"filename":2618,"language":610,"meta":524,"style":524},"import { definePlugin } from 'nitro'\nimport type { DrainContext } from 'evlog'\nimport { createAxiomDrain } from 'evlog\u002Faxiom'\nimport { createDrainPipeline } from 'evlog\u002Fpipeline'\n\nexport default definePlugin((nitroApp) => {\n  const pipeline = createDrainPipeline\u003CDrainContext>({\n    batch: { size: 50, intervalMs: 5000 },\n    retry: { maxAttempts: 3 },\n  })\n  const drain = pipeline(createAxiomDrain())\n\n  nitroApp.hooks.hook('evlog:drain', drain)\n})\n",[436,2935,2936,2954,2975,2993,3013,3017,3037,3061,3090,3109,3115,3134,3138,3164],{"__ignoreMap":524},[528,2937,2938,2940,2942,2944,2946,2948,2950,2952],{"class":530,"line":531},[528,2939,618],{"class":617},[528,2941,622],{"class":621},[528,2943,2629],{"class":625},[528,2945,629],{"class":621},[528,2947,632],{"class":617},[528,2949,635],{"class":621},[528,2951,638],{"class":537},[528,2953,641],{"class":621},[528,2955,2956,2958,2960,2962,2965,2967,2969,2971,2973],{"class":530,"line":644},[528,2957,618],{"class":617},[528,2959,1059],{"class":617},[528,2961,622],{"class":621},[528,2963,2964],{"class":625}," DrainContext",[528,2966,629],{"class":621},[528,2968,632],{"class":617},[528,2970,635],{"class":621},[528,2972,1073],{"class":537},[528,2974,641],{"class":621},[528,2976,2977,2979,2981,2983,2985,2987,2989,2991],{"class":530,"line":661},[528,2978,618],{"class":617},[528,2980,622],{"class":621},[528,2982,2648],{"class":625},[528,2984,629],{"class":621},[528,2986,632],{"class":617},[528,2988,635],{"class":621},[528,2990,2657],{"class":537},[528,2992,641],{"class":621},[528,2994,2995,2997,2999,3002,3004,3006,3008,3011],{"class":530,"line":668},[528,2996,618],{"class":617},[528,2998,622],{"class":621},[528,3000,3001],{"class":625}," createDrainPipeline",[528,3003,629],{"class":621},[528,3005,632],{"class":617},[528,3007,635],{"class":621},[528,3009,3010],{"class":537},"evlog\u002Fpipeline",[528,3012,641],{"class":621},[528,3014,3015],{"class":530,"line":686},[528,3016,665],{"emptyLinePlaceholder":664},[528,3018,3019,3021,3023,3025,3027,3029,3031,3033,3035],{"class":530,"line":698},[528,3020,671],{"class":617},[528,3022,674],{"class":617},[528,3024,2629],{"class":677},[528,3026,680],{"class":625},[528,3028,680],{"class":621},[528,3030,2678],{"class":1614},[528,3032,772],{"class":621},[528,3034,1138],{"class":905},[528,3036,695],{"class":621},[528,3038,3039,3041,3044,3046,3048,3051,3054,3057,3059],{"class":530,"line":713},[528,3040,2137],{"class":905},[528,3042,3043],{"class":625}," pipeline",[528,3045,1151],{"class":621},[528,3047,3001],{"class":677},[528,3049,3050],{"class":621},"\u003C",[528,3052,3053],{"class":534},"DrainContext",[528,3055,3056],{"class":621},">",[528,3058,680],{"class":689},[528,3060,683],{"class":621},[528,3062,3063,3066,3068,3070,3073,3075,3078,3080,3083,3085,3088],{"class":530,"line":719},[528,3064,3065],{"class":689},"    batch",[528,3067,508],{"class":621},[528,3069,622],{"class":621},[528,3071,3072],{"class":689}," size",[528,3074,508],{"class":621},[528,3076,3077],{"class":1307}," 50",[528,3079,1224],{"class":621},[528,3081,3082],{"class":689}," intervalMs",[528,3084,508],{"class":621},[528,3086,3087],{"class":1307}," 5000",[528,3089,763],{"class":621},[528,3091,3092,3095,3097,3099,3102,3104,3107],{"class":530,"line":730},[528,3093,3094],{"class":689},"    retry",[528,3096,508],{"class":621},[528,3098,622],{"class":621},[528,3100,3101],{"class":689}," maxAttempts",[528,3103,508],{"class":621},[528,3105,3106],{"class":1307}," 3",[528,3108,763],{"class":621},[528,3110,3111,3113],{"class":530,"line":740},[528,3112,2216],{"class":621},[528,3114,791],{"class":689},[528,3116,3117,3119,3122,3124,3126,3128,3131],{"class":530,"line":766},[528,3118,2137],{"class":905},[528,3120,3121],{"class":625}," drain",[528,3123,1151],{"class":621},[528,3125,3043],{"class":677},[528,3127,680],{"class":689},[528,3129,3130],{"class":677},"createAxiomDrain",[528,3132,3133],{"class":689},"())\n",[528,3135,3136],{"class":530,"line":777},[528,3137,665],{"emptyLinePlaceholder":664},[528,3139,3140,3142,3144,3146,3148,3150,3152,3154,3156,3158,3160,3162],{"class":530,"line":785},[528,3141,2706],{"class":625},[528,3143,802],{"class":621},[528,3145,2711],{"class":625},[528,3147,802],{"class":621},[528,3149,2716],{"class":677},[528,3151,680],{"class":689},[528,3153,760],{"class":621},[528,3155,2723],{"class":537},[528,3157,760],{"class":621},[528,3159,1224],{"class":621},[528,3161,3121],{"class":625},[528,3163,791],{"class":689},[528,3165,3166,3168],{"class":530,"line":1273},[528,3167,788],{"class":621},[528,3169,791],{"class":625},[441,3171,3172,3173,3176,3177,3180],{"color":443,"icon":13},"Call ",[436,3174,3175],{},"drain.flush()"," on server shutdown to ensure all buffered events are sent. See the ",[431,3178,3179],{"href":388},"Pipeline docs"," for all options.",[499,3182,3184],{"id":3183},"tail-sampling","Tail Sampling",[427,3186,3187,3188,3191],{},"Use the ",[436,3189,3190],{},"evlog:emit:keep"," hook to force-retain specific events regardless of head sampling:",[518,3193,3196],{"className":608,"code":3194,"filename":3195,"language":610,"meta":524,"style":524},"import { definePlugin } from 'nitro'\n\nexport default definePlugin((nitroApp) => {\n  nitroApp.hooks.hook('evlog:emit:keep', (ctx) => {\n    if (ctx.duration && ctx.duration > 2000) ctx.shouldKeep = true\n    if (ctx.status && ctx.status >= 500) ctx.shouldKeep = true\n  })\n})\n","server\u002Fplugins\u002Fevlog-keep.ts",[436,3197,3198,3216,3220,3240,3272,3316,3354,3360],{"__ignoreMap":524},[528,3199,3200,3202,3204,3206,3208,3210,3212,3214],{"class":530,"line":531},[528,3201,618],{"class":617},[528,3203,622],{"class":621},[528,3205,2629],{"class":625},[528,3207,629],{"class":621},[528,3209,632],{"class":617},[528,3211,635],{"class":621},[528,3213,638],{"class":537},[528,3215,641],{"class":621},[528,3217,3218],{"class":530,"line":644},[528,3219,665],{"emptyLinePlaceholder":664},[528,3221,3222,3224,3226,3228,3230,3232,3234,3236,3238],{"class":530,"line":661},[528,3223,671],{"class":617},[528,3225,674],{"class":617},[528,3227,2629],{"class":677},[528,3229,680],{"class":625},[528,3231,680],{"class":621},[528,3233,2678],{"class":1614},[528,3235,772],{"class":621},[528,3237,1138],{"class":905},[528,3239,695],{"class":621},[528,3241,3242,3244,3246,3248,3250,3252,3254,3256,3258,3260,3262,3264,3266,3268,3270],{"class":530,"line":668},[528,3243,2706],{"class":625},[528,3245,802],{"class":621},[528,3247,2711],{"class":625},[528,3249,802],{"class":621},[528,3251,2716],{"class":677},[528,3253,680],{"class":689},[528,3255,760],{"class":621},[528,3257,3190],{"class":537},[528,3259,760],{"class":621},[528,3261,1224],{"class":621},[528,3263,1816],{"class":621},[528,3265,2865],{"class":1614},[528,3267,772],{"class":621},[528,3269,1138],{"class":905},[528,3271,695],{"class":621},[528,3273,3274,3277,3279,3281,3283,3286,3289,3292,3294,3296,3299,3302,3304,3306,3308,3311,3313],{"class":530,"line":686},[528,3275,3276],{"class":617},"    if",[528,3278,1816],{"class":689},[528,3280,2865],{"class":625},[528,3282,802],{"class":621},[528,3284,3285],{"class":625},"duration",[528,3287,3288],{"class":621}," &&",[528,3290,3291],{"class":625}," ctx",[528,3293,802],{"class":621},[528,3295,3285],{"class":625},[528,3297,3298],{"class":621}," >",[528,3300,3301],{"class":1307}," 2000",[528,3303,1830],{"class":689},[528,3305,2865],{"class":625},[528,3307,802],{"class":621},[528,3309,3310],{"class":625},"shouldKeep",[528,3312,1151],{"class":621},[528,3314,3315],{"class":706}," true\n",[528,3317,3318,3320,3322,3324,3326,3328,3330,3332,3334,3336,3339,3342,3344,3346,3348,3350,3352],{"class":530,"line":698},[528,3319,3276],{"class":617},[528,3321,1816],{"class":689},[528,3323,2865],{"class":625},[528,3325,802],{"class":621},[528,3327,2271],{"class":625},[528,3329,3288],{"class":621},[528,3331,3291],{"class":625},[528,3333,802],{"class":621},[528,3335,2271],{"class":625},[528,3337,3338],{"class":621}," >=",[528,3340,3341],{"class":1307}," 500",[528,3343,1830],{"class":689},[528,3345,2865],{"class":625},[528,3347,802],{"class":621},[528,3349,3310],{"class":625},[528,3351,1151],{"class":621},[528,3353,3315],{"class":706},[528,3355,3356,3358],{"class":530,"line":713},[528,3357,2216],{"class":621},[528,3359,791],{"class":689},[528,3361,3362,3364],{"class":530,"line":719},[528,3363,788],{"class":621},[528,3365,791],{"class":625},[499,3367,3369],{"id":3368},"run-locally","Run Locally",[518,3371,3374],{"className":520,"code":3372,"filename":3373,"language":523,"meta":524,"style":524},"git clone https:\u002F\u002Fgithub.com\u002Fhugorcd\u002Fevlog.git\ncd evlog\u002Fexamples\u002Ftanstack-start\npnpm install\npnpm run dev\n","Terminal",[436,3375,3376,3387,3395,3402],{"__ignoreMap":524},[528,3377,3378,3381,3384],{"class":530,"line":531},[528,3379,3380],{"class":534},"git",[528,3382,3383],{"class":537}," clone",[528,3385,3386],{"class":537}," https:\u002F\u002Fgithub.com\u002Fhugorcd\u002Fevlog.git\n",[528,3388,3389,3392],{"class":530,"line":644},[528,3390,3391],{"class":677},"cd",[528,3393,3394],{"class":537}," evlog\u002Fexamples\u002Ftanstack-start\n",[528,3396,3397,3399],{"class":530,"line":661},[528,3398,522],{"class":534},[528,3400,3401],{"class":537}," install\n",[528,3403,3404,3406,3409],{"class":530,"line":668},[528,3405,522],{"class":534},[528,3407,3408],{"class":537}," run",[528,3410,3411],{"class":537}," dev\n",[427,3413,3414,3415,3419],{},"Open ",[431,3416,3417],{"href":3417,"rel":3418},"http:\u002F\u002Flocalhost:3000",[492]," and navigate to the evlog Demo page to test the API endpoints.",[3421,3422,3423],"card-group",{},[3424,3425,3429],"card",{"icon":3426,"title":3427,"to":3428},"i-simple-icons-github","Source Code","https:\u002F\u002Fgithub.com\u002Fhugorcd\u002Fevlog\u002Ftree\u002Fmain\u002Fexamples\u002Ftanstack-start","Browse the complete TanStack Start example source on GitHub.",[499,3431,3433],{"id":3432},"next-steps","Next Steps",[427,3435,3436,3437,3439],{},"Deepen your ",[445,3438,231],{}," integration:",[464,3441,3442,3447,3452,3457],{},[467,3443,3444,3446],{},[431,3445,51],{"href":52},": Design comprehensive events with context layering",[467,3448,3449,3451],{},[431,3450,319],{"href":324},": Send logs to Axiom, Sentry, PostHog, and more",[467,3453,3454,3456],{},[431,3455,175],{"href":176},": Control log volume with head and tail sampling",[467,3458,3459,3461,3462,817,3464,821,3466,3468],{},[431,3460,56],{"href":57},": Throw errors with ",[436,3463,816],{},[436,3465,820],{},[436,3467,824],{}," fields",[3470,3471,3472],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}",{"title":524,"searchDepth":644,"depth":644,"links":3474},[3475,3481,3482,3485,3486,3487,3490,3491,3492],{"id":501,"depth":644,"text":20,"children":3476},[3477,3478,3480],{"id":512,"depth":661,"text":513},{"id":587,"depth":661,"text":3479},"2. Add nitro.config.ts",{"id":805,"depth":661,"text":806},{"id":994,"depth":644,"text":51},{"id":1458,"depth":644,"text":1459,"children":3483},[3484],{"id":2087,"depth":661,"text":2088},{"id":2335,"depth":644,"text":170},{"id":2349,"depth":644,"text":2350},{"id":2606,"depth":644,"text":2607,"children":3488},[3489],{"id":2922,"depth":661,"text":2923},{"id":3183,"depth":644,"text":3184},{"id":3368,"depth":644,"text":3369},{"id":3432,"depth":644,"text":3433},"Automatic wide events, structured errors, and logging in TanStack Start API routes and server functions.","md",[3496],{"label":3427,"icon":3426,"to":3428,"color":3497,"variant":3498},"neutral","subtle",{},{"title":231,"icon":234},{"title":231,"description":3493},"oJOskYsSRKvPObr6ZzqpBK-BEAKQjfIsAnPBY_eHeQE",[3504,3506],{"title":226,"path":227,"stem":228,"description":3505,"icon":229,"children":-1},"Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in Nitro v2 and v3 applications.",{"title":236,"path":237,"stem":238,"description":3507,"icon":239,"children":-1},"Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in NestJS applications.",1778330171834]