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