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