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