[{"data":1,"prerenderedAt":2687},["ShallowReactive",2],{"navigation_docs":3,"-frameworks-fastify":276,"-frameworks-fastify-surround":2682},[4,30,65,105,187,246,262],{"title":5,"path":6,"stem":7,"children":8,"page":29},"Getting Started","\u002Fgetting-started","1.getting-started",[9,14,19,24],{"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",false,{"title":31,"path":32,"stem":33,"children":34,"page":29},"Logging","\u002Flogging","2.logging",[35,40,45,50,55,60],{"title":36,"path":37,"stem":38,"icon":39},"Overview","\u002Flogging\u002Foverview","2.logging\u002F0.overview","i-lucide-list",{"title":41,"path":42,"stem":43,"icon":44},"Simple Logging","\u002Flogging\u002Fsimple-logging","2.logging\u002F1.simple-logging","i-lucide-terminal",{"title":46,"path":47,"stem":48,"icon":49},"Wide Events","\u002Flogging\u002Fwide-events","2.logging\u002F2.wide-events","i-lucide-layers",{"title":51,"path":52,"stem":53,"icon":54},"Structured Errors","\u002Flogging\u002Fstructured-errors","2.logging\u002F3.structured-errors","i-lucide-shield-alert",{"title":56,"path":57,"stem":58,"icon":59},"Client Logging","\u002Flogging\u002Fclient-logging","2.logging\u002F4.client-logging","i-lucide-monitor",{"title":61,"path":62,"stem":63,"icon":64},"AI SDK Integration","\u002Flogging\u002Fai-sdk","2.logging\u002F5.ai-sdk","i-simple-icons-vercel",{"title":66,"path":67,"stem":68,"children":69,"page":29},"Core Concepts","\u002Fcore-concepts","3.core-concepts",[70,75,80,85,90,95,100],{"title":71,"path":72,"stem":73,"icon":74},"Lifecycle","\u002Fcore-concepts\u002Flifecycle","3.core-concepts\u002F0.lifecycle","i-lucide-arrow-right-left",{"title":76,"path":77,"stem":78,"icon":79},"Configuration","\u002Fcore-concepts\u002Fconfiguration","3.core-concepts\u002F1.configuration","i-lucide-settings",{"title":81,"path":82,"stem":83,"icon":84},"Sampling","\u002Fcore-concepts\u002Fsampling","3.core-concepts\u002F2.sampling","i-lucide-filter",{"title":86,"path":87,"stem":88,"icon":89},"Typed Fields","\u002Fcore-concepts\u002Ftyped-fields","3.core-concepts\u002F3.typed-fields","i-simple-icons-typescript",{"title":91,"path":92,"stem":93,"icon":94},"Best Practices","\u002Fcore-concepts\u002Fbest-practices","3.core-concepts\u002F4.best-practices","i-lucide-shield-check",{"title":96,"path":97,"stem":98,"icon":99},"Performance","\u002Fcore-concepts\u002Fperformance","3.core-concepts\u002F5.performance","i-lucide-gauge",{"title":101,"path":102,"stem":103,"icon":104},"Vite Plugin","\u002Fcore-concepts\u002Fvite-plugin","3.core-concepts\u002F6.vite-plugin","i-custom-vite",{"title":106,"path":107,"stem":108,"children":109,"page":29},"Frameworks","\u002Fframeworks","4.frameworks",[110,114,119,124,129,134,139,144,149,154,159,164,168,173,177,182],{"title":36,"path":111,"stem":112,"icon":113},"\u002Fframeworks\u002Foverview","4.frameworks\u002F00.overview","i-lucide-layout-grid",{"title":115,"path":116,"stem":117,"icon":118},"Nuxt","\u002Fframeworks\u002Fnuxt","4.frameworks\u002F01.nuxt","i-simple-icons-nuxtdotjs",{"title":120,"path":121,"stem":122,"icon":123},"Next.js","\u002Fframeworks\u002Fnextjs","4.frameworks\u002F02.nextjs","i-simple-icons-nextdotjs",{"title":125,"path":126,"stem":127,"icon":128},"SvelteKit","\u002Fframeworks\u002Fsveltekit","4.frameworks\u002F03.sveltekit","i-simple-icons-svelte",{"title":130,"path":131,"stem":132,"icon":133},"Nitro","\u002Fframeworks\u002Fnitro","4.frameworks\u002F04.nitro","i-custom-nitro",{"title":135,"path":136,"stem":137,"icon":138},"TanStack Start","\u002Fframeworks\u002Ftanstack-start","4.frameworks\u002F05.tanstack-start","i-custom-tanstack",{"title":140,"path":141,"stem":142,"icon":143},"NestJS","\u002Fframeworks\u002Fnestjs","4.frameworks\u002F06.nestjs","i-simple-icons-nestjs",{"title":145,"path":146,"stem":147,"icon":148},"Express","\u002Fframeworks\u002Fexpress","4.frameworks\u002F07.express","i-simple-icons-express",{"title":150,"path":151,"stem":152,"icon":153},"Hono","\u002Fframeworks\u002Fhono","4.frameworks\u002F08.hono","i-simple-icons-hono",{"title":155,"path":156,"stem":157,"icon":158},"Fastify","\u002Fframeworks\u002Ffastify","4.frameworks\u002F09.fastify","i-simple-icons-fastify",{"title":160,"path":161,"stem":162,"icon":163},"Elysia","\u002Fframeworks\u002Felysia","4.frameworks\u002F10.elysia","i-custom-elysia",{"title":165,"path":166,"stem":167},"React Router","\u002Fframeworks\u002Freact-router","4.frameworks\u002F11.react-router",{"title":169,"path":170,"stem":171,"icon":172},"Cloudflare Workers","\u002Fframeworks\u002Fcloudflare-workers","4.frameworks\u002F12.cloudflare-workers","i-simple-icons-cloudflare",{"title":174,"path":175,"stem":176,"icon":89},"Standalone","\u002Fframeworks\u002Fstandalone","4.frameworks\u002F13.standalone",{"title":178,"path":179,"stem":180,"icon":181},"Astro","\u002Fframeworks\u002Fastro","4.frameworks\u002F14.astro","i-simple-icons-astro",{"title":183,"path":184,"stem":185,"icon":186},"Custom Integration","\u002Fframeworks\u002Fcustom-integration","4.frameworks\u002F15.custom-integration","i-lucide-puzzle",{"title":188,"path":189,"stem":190,"children":191,"page":29},"Adapters","\u002Fadapters","5.adapters",[192,196,201,206,211,216,221,226,231,236,241],{"title":36,"path":193,"stem":194,"icon":195},"\u002Fadapters\u002Foverview","5.adapters\u002F1.overview","i-custom-plug",{"title":197,"path":198,"stem":199,"icon":200},"Pipeline","\u002Fadapters\u002Fpipeline","5.adapters\u002F10.pipeline","i-lucide-workflow",{"title":202,"path":203,"stem":204,"icon":205},"Browser","\u002Fadapters\u002Fbrowser","5.adapters\u002F11.browser","i-lucide-globe",{"title":207,"path":208,"stem":209,"icon":210},"Axiom","\u002Fadapters\u002Faxiom","5.adapters\u002F2.axiom","i-custom-axiom",{"title":212,"path":213,"stem":214,"icon":215},"OTLP","\u002Fadapters\u002Fotlp","5.adapters\u002F3.otlp","i-simple-icons-opentelemetry",{"title":217,"path":218,"stem":219,"icon":220},"PostHog","\u002Fadapters\u002Fposthog","5.adapters\u002F4.posthog","i-simple-icons-posthog",{"title":222,"path":223,"stem":224,"icon":225},"Sentry","\u002Fadapters\u002Fsentry","5.adapters\u002F5.sentry","i-simple-icons-sentry",{"title":227,"path":228,"stem":229,"icon":230},"Better Stack","\u002Fadapters\u002Fbetter-stack","5.adapters\u002F6.better-stack","i-simple-icons-betterstack",{"title":232,"path":233,"stem":234,"icon":235},"File System","\u002Fadapters\u002Ffs","5.adapters\u002F7.fs","i-lucide-hard-drive",{"title":237,"path":238,"stem":239,"icon":240},"HyperDX","\u002Fadapters\u002Fhyperdx","5.adapters\u002F8.hyperdx","i-custom-hyperdx",{"title":242,"path":243,"stem":244,"icon":245},"Custom Adapters","\u002Fadapters\u002Fcustom","5.adapters\u002F9.custom","i-lucide-code",{"title":247,"path":248,"stem":249,"children":250,"page":29},"Enrichers","\u002Fenrichers","6.enrichers",[251,254,258],{"title":36,"path":252,"stem":253,"icon":28},"\u002Fenrichers\u002Foverview","6.enrichers\u002F1.overview",{"title":255,"path":256,"stem":257,"icon":186},"Built-in","\u002Fenrichers\u002Fbuilt-in","6.enrichers\u002F2.built-in",{"title":259,"path":260,"stem":261,"icon":245},"Custom","\u002Fenrichers\u002Fcustom","6.enrichers\u002F3.custom",{"title":263,"path":264,"stem":265,"children":266,"page":29},"NuxtHub","\u002Fnuxthub","7.nuxthub",[267,271],{"title":36,"path":268,"stem":269,"icon":270},"\u002Fnuxthub\u002Foverview","7.nuxthub\u002F1.overview","i-lucide-database",{"title":272,"path":273,"stem":274,"icon":275},"Retention","\u002Fnuxthub\u002Fretention","7.nuxthub\u002F2.retention","i-lucide-clock",{"id":277,"title":155,"body":278,"description":2672,"extension":2673,"links":2674,"meta":2678,"navigation":2679,"path":156,"seo":2680,"stem":157,"__hash__":2681},"docs\u002F4.frameworks\u002F09.fastify.md",{"type":279,"value":280,"toc":2655},"minimark",[281,298,385,389,394,418,422,745,770,779,782,785,1087,1090,1154,1157,1163,1346,1464,1479,1483,1504,1829,1832,1879,1882,1892,1896,1899,2066,2070,2077,2270,2281,2285,2291,2395,2399,2409,2552,2556,2597,2606,2616,2620,2651],[282,283,284,285,289,290,293,294,297],"p",{},"The ",[286,287,288],"code",{},"evlog\u002Ffastify"," plugin auto-creates a request-scoped logger accessible via ",[286,291,292],{},"request.log"," and ",[286,295,296],{},"useLogger()",", emitting a wide event when the response completes.",[299,300,301],"code-collapse",{},[302,303,309],"pre",{"className":304,"code":305,"filename":306,"language":307,"meta":308,"style":308},"language-txt shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","Set up evlog in my Fastify app.\n\n- Install evlog: pnpm add evlog\n- Call initLogger({ env: { service: 'my-api' } }) at startup\n- Alternatively, use evlog\u002Fvite plugin in vite.config.ts for auto-init (replaces initLogger)\n- Import evlog from 'evlog\u002Ffastify' and register with app.register(evlog)\n- Access the logger via request.log in route handlers or useLogger() anywhere\n- Use log.set() to accumulate context throughout the request\n- Optionally pass drain, enrich, include, and keep options when registering\n\nDocs: https:\u002F\u002Fwww.evlog.dev\u002Fframeworks\u002Ffastify\nAdapters: https:\u002F\u002Fwww.evlog.dev\u002Fadapters\n","Prompt","txt","",[286,310,311,319,326,332,338,344,350,356,362,368,373,379],{"__ignoreMap":308},[312,313,316],"span",{"class":314,"line":315},"line",1,[312,317,318],{},"Set up evlog in my Fastify app.\n",[312,320,322],{"class":314,"line":321},2,[312,323,325],{"emptyLinePlaceholder":324},true,"\n",[312,327,329],{"class":314,"line":328},3,[312,330,331],{},"- Install evlog: pnpm add evlog\n",[312,333,335],{"class":314,"line":334},4,[312,336,337],{},"- Call initLogger({ env: { service: 'my-api' } }) at startup\n",[312,339,341],{"class":314,"line":340},5,[312,342,343],{},"- Alternatively, use evlog\u002Fvite plugin in vite.config.ts for auto-init (replaces initLogger)\n",[312,345,347],{"class":314,"line":346},6,[312,348,349],{},"- Import evlog from 'evlog\u002Ffastify' and register with app.register(evlog)\n",[312,351,353],{"class":314,"line":352},7,[312,354,355],{},"- Access the logger via request.log in route handlers or useLogger() anywhere\n",[312,357,359],{"class":314,"line":358},8,[312,360,361],{},"- Use log.set() to accumulate context throughout the request\n",[312,363,365],{"class":314,"line":364},9,[312,366,367],{},"- Optionally pass drain, enrich, include, and keep options when registering\n",[312,369,371],{"class":314,"line":370},10,[312,372,325],{"emptyLinePlaceholder":324},[312,374,376],{"class":314,"line":375},11,[312,377,378],{},"Docs: https:\u002F\u002Fwww.evlog.dev\u002Fframeworks\u002Ffastify\n",[312,380,382],{"class":314,"line":381},12,[312,383,384],{},"Adapters: https:\u002F\u002Fwww.evlog.dev\u002Fadapters\n",[386,387,20],"h2",{"id":388},"quick-start",[390,391,393],"h3",{"id":392},"_1-install","1. Install",[302,395,400],{"className":396,"code":397,"filename":398,"language":399,"meta":308,"style":308},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","bun add evlog fastify\n","Terminal","bash",[286,401,402],{"__ignoreMap":308},[312,403,404,408,412,415],{"class":314,"line":315},[312,405,407],{"class":406},"sBMFI","bun",[312,409,411],{"class":410},"sfazB"," add",[312,413,414],{"class":410}," evlog",[312,416,417],{"class":410}," fastify\n",[390,419,421],{"id":420},"_2-initialize-and-register-the-plugin","2. Initialize and register the plugin",[302,423,428],{"className":424,"code":425,"filename":426,"language":427,"meta":308,"style":308},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import Fastify from 'fastify'\nimport { initLogger } from 'evlog'\nimport { evlog } from 'evlog\u002Ffastify'\n\ninitLogger({\n  env: { service: 'my-api' },\n})\n\nconst app = Fastify({ logger: false })\n\nawait app.register(evlog)\n\napp.get('\u002Fhealth', async (request) => {\n  request.log.set({ route: 'health' })\n  return { ok: true }\n})\n\nawait app.listen({ port: 3000 })\n","src\u002Findex.ts","typescript",[286,429,430,453,476,494,498,510,537,545,549,582,586,603,607,649,685,704,711,716],{"__ignoreMap":308},[312,431,432,436,440,443,447,450],{"class":314,"line":315},[312,433,435],{"class":434},"s7zQu","import",[312,437,439],{"class":438},"sTEyZ"," Fastify ",[312,441,442],{"class":434},"from",[312,444,446],{"class":445},"sMK4o"," '",[312,448,449],{"class":410},"fastify",[312,451,452],{"class":445},"'\n",[312,454,455,457,460,463,466,469,471,474],{"class":314,"line":321},[312,456,435],{"class":434},[312,458,459],{"class":445}," {",[312,461,462],{"class":438}," initLogger",[312,464,465],{"class":445}," }",[312,467,468],{"class":434}," from",[312,470,446],{"class":445},[312,472,473],{"class":410},"evlog",[312,475,452],{"class":445},[312,477,478,480,482,484,486,488,490,492],{"class":314,"line":328},[312,479,435],{"class":434},[312,481,459],{"class":445},[312,483,414],{"class":438},[312,485,465],{"class":445},[312,487,468],{"class":434},[312,489,446],{"class":445},[312,491,288],{"class":410},[312,493,452],{"class":445},[312,495,496],{"class":314,"line":334},[312,497,325],{"emptyLinePlaceholder":324},[312,499,500,504,507],{"class":314,"line":340},[312,501,503],{"class":502},"s2Zo4","initLogger",[312,505,506],{"class":438},"(",[312,508,509],{"class":445},"{\n",[312,511,512,516,519,521,524,526,528,531,534],{"class":314,"line":346},[312,513,515],{"class":514},"swJcz","  env",[312,517,518],{"class":445},":",[312,520,459],{"class":445},[312,522,523],{"class":514}," service",[312,525,518],{"class":445},[312,527,446],{"class":445},[312,529,530],{"class":410},"my-api",[312,532,533],{"class":445},"'",[312,535,536],{"class":445}," },\n",[312,538,539,542],{"class":314,"line":352},[312,540,541],{"class":445},"}",[312,543,544],{"class":438},")\n",[312,546,547],{"class":314,"line":358},[312,548,325],{"emptyLinePlaceholder":324},[312,550,551,555,558,561,564,566,569,572,574,578,580],{"class":314,"line":364},[312,552,554],{"class":553},"spNyl","const",[312,556,557],{"class":438}," app ",[312,559,560],{"class":445},"=",[312,562,563],{"class":502}," Fastify",[312,565,506],{"class":438},[312,567,568],{"class":445},"{",[312,570,571],{"class":514}," logger",[312,573,518],{"class":445},[312,575,577],{"class":576},"sfNiH"," false",[312,579,465],{"class":445},[312,581,544],{"class":438},[312,583,584],{"class":314,"line":370},[312,585,325],{"emptyLinePlaceholder":324},[312,587,588,591,594,597,600],{"class":314,"line":375},[312,589,590],{"class":434},"await",[312,592,593],{"class":438}," app",[312,595,596],{"class":445},".",[312,598,599],{"class":502},"register",[312,601,602],{"class":438},"(evlog)\n",[312,604,605],{"class":314,"line":381},[312,606,325],{"emptyLinePlaceholder":324},[312,608,610,613,615,618,620,622,625,627,630,633,636,640,643,646],{"class":314,"line":609},13,[312,611,612],{"class":438},"app",[312,614,596],{"class":445},[312,616,617],{"class":502},"get",[312,619,506],{"class":438},[312,621,533],{"class":445},[312,623,624],{"class":410},"\u002Fhealth",[312,626,533],{"class":445},[312,628,629],{"class":445},",",[312,631,632],{"class":553}," async",[312,634,635],{"class":445}," (",[312,637,639],{"class":638},"sHdIc","request",[312,641,642],{"class":445},")",[312,644,645],{"class":553}," =>",[312,647,648],{"class":445}," {\n",[312,650,652,655,657,660,662,665,667,669,672,674,676,679,681,683],{"class":314,"line":651},14,[312,653,654],{"class":438},"  request",[312,656,596],{"class":445},[312,658,659],{"class":438},"log",[312,661,596],{"class":445},[312,663,664],{"class":502},"set",[312,666,506],{"class":514},[312,668,568],{"class":445},[312,670,671],{"class":514}," route",[312,673,518],{"class":445},[312,675,446],{"class":445},[312,677,678],{"class":410},"health",[312,680,533],{"class":445},[312,682,465],{"class":445},[312,684,544],{"class":514},[312,686,688,691,693,696,698,701],{"class":314,"line":687},15,[312,689,690],{"class":434},"  return",[312,692,459],{"class":445},[312,694,695],{"class":514}," ok",[312,697,518],{"class":445},[312,699,700],{"class":576}," true",[312,702,703],{"class":445}," }\n",[312,705,707,709],{"class":314,"line":706},16,[312,708,541],{"class":445},[312,710,544],{"class":438},[312,712,714],{"class":314,"line":713},17,[312,715,325],{"emptyLinePlaceholder":324},[312,717,719,721,723,725,728,730,732,735,737,741,743],{"class":314,"line":718},18,[312,720,590],{"class":434},[312,722,593],{"class":438},[312,724,596],{"class":445},[312,726,727],{"class":502},"listen",[312,729,506],{"class":438},[312,731,568],{"class":445},[312,733,734],{"class":514}," port",[312,736,518],{"class":445},[312,738,740],{"class":739},"sbssI"," 3000",[312,742,465],{"class":445},[312,744,544],{"class":438},[746,747,749,753,754,761,762,765,766,769],"callout",{"color":748,"icon":104},"info",[750,751,752],"strong",{},"Using Vite?"," The ",[755,756,757,760],"a",{"href":102},[286,758,759],{},"evlog\u002Fvite"," plugin"," replaces the ",[286,763,764],{},"initLogger()"," call with compile-time auto-initialization, strips ",[286,767,768],{},"log.debug()"," from production builds, and injects source locations.",[282,771,772,774,775,778],{},[286,773,292],{}," is the evlog wide-event logger and shadows Fastify's built-in pino logger on the request. The pino logger remains accessible via ",[286,776,777],{},"fastify.log"," for server-level structured logging.",[386,780,46],{"id":781},"wide-events",[282,783,784],{},"Build up context progressively through your handler. One request = one wide event:",[302,786,788],{"className":424,"code":787,"filename":426,"language":427,"meta":308,"style":308},"app.get('\u002Fusers\u002F:id', async (request) => {\n  const { id } = request.params as { id: string }\n\n  request.log.set({ user: { id } })\n\n  const user = await db.findUser(id)\n  request.log.set({ user: { name: user.name, plan: user.plan } })\n\n  const orders = await db.findOrders(id)\n  request.log.set({ orders: { count: orders.length, totalRevenue: sum(orders) } })\n\n  return { user, orders }\n})\n",[286,789,790,821,858,862,893,897,923,977,981,1005,1063,1067,1081],{"__ignoreMap":308},[312,791,792,794,796,798,800,802,805,807,809,811,813,815,817,819],{"class":314,"line":315},[312,793,612],{"class":438},[312,795,596],{"class":445},[312,797,617],{"class":502},[312,799,506],{"class":438},[312,801,533],{"class":445},[312,803,804],{"class":410},"\u002Fusers\u002F:id",[312,806,533],{"class":445},[312,808,629],{"class":445},[312,810,632],{"class":553},[312,812,635],{"class":445},[312,814,639],{"class":638},[312,816,642],{"class":445},[312,818,645],{"class":553},[312,820,648],{"class":445},[312,822,823,826,828,831,833,836,839,841,844,847,849,851,853,856],{"class":314,"line":321},[312,824,825],{"class":553},"  const",[312,827,459],{"class":445},[312,829,830],{"class":438}," id",[312,832,465],{"class":445},[312,834,835],{"class":445}," =",[312,837,838],{"class":438}," request",[312,840,596],{"class":445},[312,842,843],{"class":438},"params",[312,845,846],{"class":434}," as",[312,848,459],{"class":445},[312,850,830],{"class":514},[312,852,518],{"class":445},[312,854,855],{"class":406}," string",[312,857,703],{"class":445},[312,859,860],{"class":314,"line":328},[312,861,325],{"emptyLinePlaceholder":324},[312,863,864,866,868,870,872,874,876,878,881,883,885,887,889,891],{"class":314,"line":334},[312,865,654],{"class":438},[312,867,596],{"class":445},[312,869,659],{"class":438},[312,871,596],{"class":445},[312,873,664],{"class":502},[312,875,506],{"class":514},[312,877,568],{"class":445},[312,879,880],{"class":514}," user",[312,882,518],{"class":445},[312,884,459],{"class":445},[312,886,830],{"class":438},[312,888,465],{"class":445},[312,890,465],{"class":445},[312,892,544],{"class":514},[312,894,895],{"class":314,"line":340},[312,896,325],{"emptyLinePlaceholder":324},[312,898,899,901,903,905,908,911,913,916,918,921],{"class":314,"line":346},[312,900,825],{"class":553},[312,902,880],{"class":438},[312,904,835],{"class":445},[312,906,907],{"class":434}," await",[312,909,910],{"class":438}," db",[312,912,596],{"class":445},[312,914,915],{"class":502},"findUser",[312,917,506],{"class":514},[312,919,920],{"class":438},"id",[312,922,544],{"class":514},[312,924,925,927,929,931,933,935,937,939,941,943,945,948,950,952,954,957,959,962,964,966,968,971,973,975],{"class":314,"line":352},[312,926,654],{"class":438},[312,928,596],{"class":445},[312,930,659],{"class":438},[312,932,596],{"class":445},[312,934,664],{"class":502},[312,936,506],{"class":514},[312,938,568],{"class":445},[312,940,880],{"class":514},[312,942,518],{"class":445},[312,944,459],{"class":445},[312,946,947],{"class":514}," name",[312,949,518],{"class":445},[312,951,880],{"class":438},[312,953,596],{"class":445},[312,955,956],{"class":438},"name",[312,958,629],{"class":445},[312,960,961],{"class":514}," plan",[312,963,518],{"class":445},[312,965,880],{"class":438},[312,967,596],{"class":445},[312,969,970],{"class":438},"plan",[312,972,465],{"class":445},[312,974,465],{"class":445},[312,976,544],{"class":514},[312,978,979],{"class":314,"line":358},[312,980,325],{"emptyLinePlaceholder":324},[312,982,983,985,988,990,992,994,996,999,1001,1003],{"class":314,"line":364},[312,984,825],{"class":553},[312,986,987],{"class":438}," orders",[312,989,835],{"class":445},[312,991,907],{"class":434},[312,993,910],{"class":438},[312,995,596],{"class":445},[312,997,998],{"class":502},"findOrders",[312,1000,506],{"class":514},[312,1002,920],{"class":438},[312,1004,544],{"class":514},[312,1006,1007,1009,1011,1013,1015,1017,1019,1021,1023,1025,1027,1030,1032,1034,1036,1039,1041,1044,1046,1049,1051,1054,1057,1059,1061],{"class":314,"line":370},[312,1008,654],{"class":438},[312,1010,596],{"class":445},[312,1012,659],{"class":438},[312,1014,596],{"class":445},[312,1016,664],{"class":502},[312,1018,506],{"class":514},[312,1020,568],{"class":445},[312,1022,987],{"class":514},[312,1024,518],{"class":445},[312,1026,459],{"class":445},[312,1028,1029],{"class":514}," count",[312,1031,518],{"class":445},[312,1033,987],{"class":438},[312,1035,596],{"class":445},[312,1037,1038],{"class":438},"length",[312,1040,629],{"class":445},[312,1042,1043],{"class":514}," totalRevenue",[312,1045,518],{"class":445},[312,1047,1048],{"class":502}," sum",[312,1050,506],{"class":514},[312,1052,1053],{"class":438},"orders",[312,1055,1056],{"class":514},") ",[312,1058,541],{"class":445},[312,1060,465],{"class":445},[312,1062,544],{"class":514},[312,1064,1065],{"class":314,"line":375},[312,1066,325],{"emptyLinePlaceholder":324},[312,1068,1069,1071,1073,1075,1077,1079],{"class":314,"line":381},[312,1070,690],{"class":434},[312,1072,459],{"class":445},[312,1074,880],{"class":438},[312,1076,629],{"class":445},[312,1078,987],{"class":438},[312,1080,703],{"class":445},[312,1082,1083,1085],{"class":314,"line":609},[312,1084,541],{"class":445},[312,1086,544],{"class":438},[282,1088,1089],{},"All fields are merged into a single wide event emitted when the request completes:",[302,1091,1094],{"className":396,"code":1092,"filename":1093,"language":399,"meta":308,"style":308},"14:58:15 INFO [my-api] GET \u002Fusers\u002Fusr_123 200 in 12ms\n  ├─ orders: count=2 totalRevenue=6298\n  ├─ user: id=usr_123 name=Alice plan=pro\n  └─ requestId: 4a8ff3a8-...\n","Terminal output",[286,1095,1096,1107,1127,1143],{"__ignoreMap":308},[312,1097,1098,1101,1104],{"class":314,"line":315},[312,1099,1100],{"class":406},"14:58:15",[312,1102,1103],{"class":410}," INFO",[312,1105,1106],{"class":438}," [my-api] GET \u002Fusers\u002Fusr_123 200 in 12ms\n",[312,1108,1109,1112,1115,1118,1121,1124],{"class":314,"line":321},[312,1110,1111],{"class":406},"  ├─",[312,1113,1114],{"class":410}," orders:",[312,1116,1117],{"class":410}," count=",[312,1119,1120],{"class":739},"2",[312,1122,1123],{"class":410}," totalRevenue=",[312,1125,1126],{"class":739},"6298\n",[312,1128,1129,1131,1134,1137,1140],{"class":314,"line":328},[312,1130,1111],{"class":406},[312,1132,1133],{"class":410}," user:",[312,1135,1136],{"class":410}," id=usr_123",[312,1138,1139],{"class":410}," name=Alice",[312,1141,1142],{"class":410}," plan=pro\n",[312,1144,1145,1148,1151],{"class":314,"line":334},[312,1146,1147],{"class":406},"  └─",[312,1149,1150],{"class":410}," requestId:",[312,1152,1153],{"class":410}," 4a8ff3a8-...\n",[386,1155,296],{"id":1156},"uselogger",[282,1158,1159,1160,1162],{},"Use ",[286,1161,296],{}," to access the request-scoped logger from anywhere in the call stack without passing the request object through your service layer:",[302,1164,1167],{"className":424,"code":1165,"filename":1166,"language":427,"meta":308,"style":308},"import { useLogger } from 'evlog\u002Ffastify'\n\nexport async function findUser(id: string) {\n  const log = useLogger()\n  log.set({ user: { id } })\n\n  const user = await db.findUser(id)\n  log.set({ user: { name: user.name, plan: user.plan } })\n\n  return user\n}\n","src\u002Fservices\u002Fuser.ts",[286,1168,1169,1188,1192,1217,1231,1258,1262,1284,1330,1334,1341],{"__ignoreMap":308},[312,1170,1171,1173,1175,1178,1180,1182,1184,1186],{"class":314,"line":315},[312,1172,435],{"class":434},[312,1174,459],{"class":445},[312,1176,1177],{"class":438}," useLogger",[312,1179,465],{"class":445},[312,1181,468],{"class":434},[312,1183,446],{"class":445},[312,1185,288],{"class":410},[312,1187,452],{"class":445},[312,1189,1190],{"class":314,"line":321},[312,1191,325],{"emptyLinePlaceholder":324},[312,1193,1194,1197,1199,1202,1205,1207,1209,1211,1213,1215],{"class":314,"line":328},[312,1195,1196],{"class":434},"export",[312,1198,632],{"class":553},[312,1200,1201],{"class":553}," function",[312,1203,1204],{"class":502}," findUser",[312,1206,506],{"class":445},[312,1208,920],{"class":638},[312,1210,518],{"class":445},[312,1212,855],{"class":406},[312,1214,642],{"class":445},[312,1216,648],{"class":445},[312,1218,1219,1221,1224,1226,1228],{"class":314,"line":334},[312,1220,825],{"class":553},[312,1222,1223],{"class":438}," log",[312,1225,835],{"class":445},[312,1227,1177],{"class":502},[312,1229,1230],{"class":514},"()\n",[312,1232,1233,1236,1238,1240,1242,1244,1246,1248,1250,1252,1254,1256],{"class":314,"line":340},[312,1234,1235],{"class":438},"  log",[312,1237,596],{"class":445},[312,1239,664],{"class":502},[312,1241,506],{"class":514},[312,1243,568],{"class":445},[312,1245,880],{"class":514},[312,1247,518],{"class":445},[312,1249,459],{"class":445},[312,1251,830],{"class":438},[312,1253,465],{"class":445},[312,1255,465],{"class":445},[312,1257,544],{"class":514},[312,1259,1260],{"class":314,"line":346},[312,1261,325],{"emptyLinePlaceholder":324},[312,1263,1264,1266,1268,1270,1272,1274,1276,1278,1280,1282],{"class":314,"line":352},[312,1265,825],{"class":553},[312,1267,880],{"class":438},[312,1269,835],{"class":445},[312,1271,907],{"class":434},[312,1273,910],{"class":438},[312,1275,596],{"class":445},[312,1277,915],{"class":502},[312,1279,506],{"class":514},[312,1281,920],{"class":438},[312,1283,544],{"class":514},[312,1285,1286,1288,1290,1292,1294,1296,1298,1300,1302,1304,1306,1308,1310,1312,1314,1316,1318,1320,1322,1324,1326,1328],{"class":314,"line":358},[312,1287,1235],{"class":438},[312,1289,596],{"class":445},[312,1291,664],{"class":502},[312,1293,506],{"class":514},[312,1295,568],{"class":445},[312,1297,880],{"class":514},[312,1299,518],{"class":445},[312,1301,459],{"class":445},[312,1303,947],{"class":514},[312,1305,518],{"class":445},[312,1307,880],{"class":438},[312,1309,596],{"class":445},[312,1311,956],{"class":438},[312,1313,629],{"class":445},[312,1315,961],{"class":514},[312,1317,518],{"class":445},[312,1319,880],{"class":438},[312,1321,596],{"class":445},[312,1323,970],{"class":438},[312,1325,465],{"class":445},[312,1327,465],{"class":445},[312,1329,544],{"class":514},[312,1331,1332],{"class":314,"line":364},[312,1333,325],{"emptyLinePlaceholder":324},[312,1335,1336,1338],{"class":314,"line":370},[312,1337,690],{"class":434},[312,1339,1340],{"class":438}," user\n",[312,1342,1343],{"class":314,"line":375},[312,1344,1345],{"class":445},"}\n",[302,1347,1349],{"className":424,"code":1348,"filename":426,"language":427,"meta":308,"style":308},"import { findUser } from '.\u002Fservices\u002Fuser'\n\napp.get('\u002Fusers\u002F:id', async (request) => {\n  const { id } = request.params as { id: string }\n  const user = await findUser(id)\n  return user\n})\n",[286,1350,1351,1370,1374,1404,1434,1452,1458],{"__ignoreMap":308},[312,1352,1353,1355,1357,1359,1361,1363,1365,1368],{"class":314,"line":315},[312,1354,435],{"class":434},[312,1356,459],{"class":445},[312,1358,1204],{"class":438},[312,1360,465],{"class":445},[312,1362,468],{"class":434},[312,1364,446],{"class":445},[312,1366,1367],{"class":410},".\u002Fservices\u002Fuser",[312,1369,452],{"class":445},[312,1371,1372],{"class":314,"line":321},[312,1373,325],{"emptyLinePlaceholder":324},[312,1375,1376,1378,1380,1382,1384,1386,1388,1390,1392,1394,1396,1398,1400,1402],{"class":314,"line":328},[312,1377,612],{"class":438},[312,1379,596],{"class":445},[312,1381,617],{"class":502},[312,1383,506],{"class":438},[312,1385,533],{"class":445},[312,1387,804],{"class":410},[312,1389,533],{"class":445},[312,1391,629],{"class":445},[312,1393,632],{"class":553},[312,1395,635],{"class":445},[312,1397,639],{"class":638},[312,1399,642],{"class":445},[312,1401,645],{"class":553},[312,1403,648],{"class":445},[312,1405,1406,1408,1410,1412,1414,1416,1418,1420,1422,1424,1426,1428,1430,1432],{"class":314,"line":334},[312,1407,825],{"class":553},[312,1409,459],{"class":445},[312,1411,830],{"class":438},[312,1413,465],{"class":445},[312,1415,835],{"class":445},[312,1417,838],{"class":438},[312,1419,596],{"class":445},[312,1421,843],{"class":438},[312,1423,846],{"class":434},[312,1425,459],{"class":445},[312,1427,830],{"class":514},[312,1429,518],{"class":445},[312,1431,855],{"class":406},[312,1433,703],{"class":445},[312,1435,1436,1438,1440,1442,1444,1446,1448,1450],{"class":314,"line":340},[312,1437,825],{"class":553},[312,1439,880],{"class":438},[312,1441,835],{"class":445},[312,1443,907],{"class":434},[312,1445,1204],{"class":502},[312,1447,506],{"class":514},[312,1449,920],{"class":438},[312,1451,544],{"class":514},[312,1453,1454,1456],{"class":314,"line":346},[312,1455,690],{"class":434},[312,1457,1340],{"class":438},[312,1459,1460,1462],{"class":314,"line":352},[312,1461,541],{"class":445},[312,1463,544],{"class":438},[282,1465,1466,1467,293,1469,1471,1472,1474,1475,1478],{},"Both ",[286,1468,292],{},[286,1470,296],{}," return the same logger instance. ",[286,1473,296],{}," uses ",[286,1476,1477],{},"AsyncLocalStorage"," to propagate the logger across async boundaries.",[386,1480,1482],{"id":1481},"error-handling","Error Handling",[282,1484,1159,1485,1488,1489,1492,1493,1496,1497,1500,1501,518],{},[286,1486,1487],{},"createError"," for structured errors with ",[286,1490,1491],{},"why",", ",[286,1494,1495],{},"fix",", and ",[286,1498,1499],{},"link"," fields. Fastify captures thrown errors via ",[286,1502,1503],{},"onError",[302,1505,1507],{"className":424,"code":1506,"filename":426,"language":427,"meta":308,"style":308},"import { createError, parseError } from 'evlog'\n\napp.get('\u002Fcheckout', async (_request, reply) => {\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\napp.setErrorHandler((error, _request, reply) => {\n  const parsed = parseError(error)\n  reply.status(parsed.status).send({\n    message: parsed.message,\n    why: parsed.why,\n    fix: parsed.fix,\n    link: parsed.link,\n  })\n})\n",[286,1508,1509,1533,1537,1574,1585,1602,1614,1630,1646,1662,1669,1675,1679,1710,1727,1757,1772,1786,1800,1815,1822],{"__ignoreMap":308},[312,1510,1511,1513,1515,1518,1520,1523,1525,1527,1529,1531],{"class":314,"line":315},[312,1512,435],{"class":434},[312,1514,459],{"class":445},[312,1516,1517],{"class":438}," createError",[312,1519,629],{"class":445},[312,1521,1522],{"class":438}," parseError",[312,1524,465],{"class":445},[312,1526,468],{"class":434},[312,1528,446],{"class":445},[312,1530,473],{"class":410},[312,1532,452],{"class":445},[312,1534,1535],{"class":314,"line":321},[312,1536,325],{"emptyLinePlaceholder":324},[312,1538,1539,1541,1543,1545,1547,1549,1552,1554,1556,1558,1560,1563,1565,1568,1570,1572],{"class":314,"line":328},[312,1540,612],{"class":438},[312,1542,596],{"class":445},[312,1544,617],{"class":502},[312,1546,506],{"class":438},[312,1548,533],{"class":445},[312,1550,1551],{"class":410},"\u002Fcheckout",[312,1553,533],{"class":445},[312,1555,629],{"class":445},[312,1557,632],{"class":553},[312,1559,635],{"class":445},[312,1561,1562],{"class":638},"_request",[312,1564,629],{"class":445},[312,1566,1567],{"class":638}," reply",[312,1569,642],{"class":445},[312,1571,645],{"class":553},[312,1573,648],{"class":445},[312,1575,1576,1579,1581,1583],{"class":314,"line":334},[312,1577,1578],{"class":434},"  throw",[312,1580,1517],{"class":502},[312,1582,506],{"class":514},[312,1584,509],{"class":445},[312,1586,1587,1590,1592,1594,1597,1599],{"class":314,"line":340},[312,1588,1589],{"class":514},"    message",[312,1591,518],{"class":445},[312,1593,446],{"class":445},[312,1595,1596],{"class":410},"Payment failed",[312,1598,533],{"class":445},[312,1600,1601],{"class":445},",\n",[312,1603,1604,1607,1609,1612],{"class":314,"line":346},[312,1605,1606],{"class":514},"    status",[312,1608,518],{"class":445},[312,1610,1611],{"class":739}," 402",[312,1613,1601],{"class":445},[312,1615,1616,1619,1621,1623,1626,1628],{"class":314,"line":352},[312,1617,1618],{"class":514},"    why",[312,1620,518],{"class":445},[312,1622,446],{"class":445},[312,1624,1625],{"class":410},"Card declined by issuer",[312,1627,533],{"class":445},[312,1629,1601],{"class":445},[312,1631,1632,1635,1637,1639,1642,1644],{"class":314,"line":358},[312,1633,1634],{"class":514},"    fix",[312,1636,518],{"class":445},[312,1638,446],{"class":445},[312,1640,1641],{"class":410},"Try a different payment method",[312,1643,533],{"class":445},[312,1645,1601],{"class":445},[312,1647,1648,1651,1653,1655,1658,1660],{"class":314,"line":364},[312,1649,1650],{"class":514},"    link",[312,1652,518],{"class":445},[312,1654,446],{"class":445},[312,1656,1657],{"class":410},"https:\u002F\u002Fdocs.example.com\u002Fpayments\u002Fdeclined",[312,1659,533],{"class":445},[312,1661,1601],{"class":445},[312,1663,1664,1667],{"class":314,"line":370},[312,1665,1666],{"class":445},"  }",[312,1668,544],{"class":514},[312,1670,1671,1673],{"class":314,"line":375},[312,1672,541],{"class":445},[312,1674,544],{"class":438},[312,1676,1677],{"class":314,"line":381},[312,1678,325],{"emptyLinePlaceholder":324},[312,1680,1681,1683,1685,1688,1690,1692,1695,1697,1700,1702,1704,1706,1708],{"class":314,"line":609},[312,1682,612],{"class":438},[312,1684,596],{"class":445},[312,1686,1687],{"class":502},"setErrorHandler",[312,1689,506],{"class":438},[312,1691,506],{"class":445},[312,1693,1694],{"class":638},"error",[312,1696,629],{"class":445},[312,1698,1699],{"class":638}," _request",[312,1701,629],{"class":445},[312,1703,1567],{"class":638},[312,1705,642],{"class":445},[312,1707,645],{"class":553},[312,1709,648],{"class":445},[312,1711,1712,1714,1717,1719,1721,1723,1725],{"class":314,"line":651},[312,1713,825],{"class":553},[312,1715,1716],{"class":438}," parsed",[312,1718,835],{"class":445},[312,1720,1522],{"class":502},[312,1722,506],{"class":514},[312,1724,1694],{"class":438},[312,1726,544],{"class":514},[312,1728,1729,1732,1734,1737,1739,1742,1744,1746,1748,1750,1753,1755],{"class":314,"line":687},[312,1730,1731],{"class":438},"  reply",[312,1733,596],{"class":445},[312,1735,1736],{"class":502},"status",[312,1738,506],{"class":514},[312,1740,1741],{"class":438},"parsed",[312,1743,596],{"class":445},[312,1745,1736],{"class":438},[312,1747,642],{"class":514},[312,1749,596],{"class":445},[312,1751,1752],{"class":502},"send",[312,1754,506],{"class":514},[312,1756,509],{"class":445},[312,1758,1759,1761,1763,1765,1767,1770],{"class":314,"line":706},[312,1760,1589],{"class":514},[312,1762,518],{"class":445},[312,1764,1716],{"class":438},[312,1766,596],{"class":445},[312,1768,1769],{"class":438},"message",[312,1771,1601],{"class":445},[312,1773,1774,1776,1778,1780,1782,1784],{"class":314,"line":713},[312,1775,1618],{"class":514},[312,1777,518],{"class":445},[312,1779,1716],{"class":438},[312,1781,596],{"class":445},[312,1783,1491],{"class":438},[312,1785,1601],{"class":445},[312,1787,1788,1790,1792,1794,1796,1798],{"class":314,"line":718},[312,1789,1634],{"class":514},[312,1791,518],{"class":445},[312,1793,1716],{"class":438},[312,1795,596],{"class":445},[312,1797,1495],{"class":438},[312,1799,1601],{"class":445},[312,1801,1803,1805,1807,1809,1811,1813],{"class":314,"line":1802},19,[312,1804,1650],{"class":514},[312,1806,518],{"class":445},[312,1808,1716],{"class":438},[312,1810,596],{"class":445},[312,1812,1499],{"class":438},[312,1814,1601],{"class":445},[312,1816,1818,1820],{"class":314,"line":1817},20,[312,1819,1666],{"class":445},[312,1821,544],{"class":514},[312,1823,1825,1827],{"class":314,"line":1824},21,[312,1826,541],{"class":445},[312,1828,544],{"class":438},[282,1830,1831],{},"The error is captured and logged with both the custom context and structured error fields:",[302,1833,1835],{"className":396,"code":1834,"filename":1093,"language":399,"meta":308,"style":308},"14:58:20 ERROR [my-api] GET \u002Fcheckout 402 in 3ms\n  ├─ error: name=EvlogError message=Payment failed status=402\n  └─ requestId: 880a50ac-...\n",[286,1836,1837,1848,1870],{"__ignoreMap":308},[312,1838,1839,1842,1845],{"class":314,"line":315},[312,1840,1841],{"class":406},"14:58:20",[312,1843,1844],{"class":410}," ERROR",[312,1846,1847],{"class":438}," [my-api] GET \u002Fcheckout 402 in 3ms\n",[312,1849,1850,1852,1855,1858,1861,1864,1867],{"class":314,"line":321},[312,1851,1111],{"class":406},[312,1853,1854],{"class":410}," error:",[312,1856,1857],{"class":410}," name=EvlogError",[312,1859,1860],{"class":410}," message=Payment",[312,1862,1863],{"class":410}," failed",[312,1865,1866],{"class":410}," status=",[312,1868,1869],{"class":739},"402\n",[312,1871,1872,1874,1876],{"class":314,"line":328},[312,1873,1147],{"class":406},[312,1875,1150],{"class":410},[312,1877,1878],{"class":410}," 880a50ac-...\n",[386,1880,76],{"id":1881},"configuration",[282,1883,1884,1885,1888,1889,1891],{},"See the ",[755,1886,1887],{"href":77},"Configuration reference"," for all available options (",[286,1890,503],{},", middleware options, sampling, silent mode, etc.).",[386,1893,1895],{"id":1894},"drain-enrichers","Drain & Enrichers",[282,1897,1898],{},"Configure drain adapters and enrichers directly in the plugin options:",[302,1900,1902],{"className":424,"code":1901,"filename":426,"language":427,"meta":308,"style":308},"import { createAxiomDrain } from 'evlog\u002Faxiom'\nimport { createUserAgentEnricher } from 'evlog\u002Fenrichers'\n\nconst userAgent = createUserAgentEnricher()\n\nawait app.register(evlog, {\n  drain: createAxiomDrain(),\n  enrich: (ctx) => {\n    userAgent(ctx)\n    ctx.event.region = process.env.FLY_REGION\n  },\n})\n",[286,1903,1904,1924,1944,1948,1961,1965,1982,1996,2014,2025,2055,2060],{"__ignoreMap":308},[312,1905,1906,1908,1910,1913,1915,1917,1919,1922],{"class":314,"line":315},[312,1907,435],{"class":434},[312,1909,459],{"class":445},[312,1911,1912],{"class":438}," createAxiomDrain",[312,1914,465],{"class":445},[312,1916,468],{"class":434},[312,1918,446],{"class":445},[312,1920,1921],{"class":410},"evlog\u002Faxiom",[312,1923,452],{"class":445},[312,1925,1926,1928,1930,1933,1935,1937,1939,1942],{"class":314,"line":321},[312,1927,435],{"class":434},[312,1929,459],{"class":445},[312,1931,1932],{"class":438}," createUserAgentEnricher",[312,1934,465],{"class":445},[312,1936,468],{"class":434},[312,1938,446],{"class":445},[312,1940,1941],{"class":410},"evlog\u002Fenrichers",[312,1943,452],{"class":445},[312,1945,1946],{"class":314,"line":328},[312,1947,325],{"emptyLinePlaceholder":324},[312,1949,1950,1952,1955,1957,1959],{"class":314,"line":334},[312,1951,554],{"class":553},[312,1953,1954],{"class":438}," userAgent ",[312,1956,560],{"class":445},[312,1958,1932],{"class":502},[312,1960,1230],{"class":438},[312,1962,1963],{"class":314,"line":340},[312,1964,325],{"emptyLinePlaceholder":324},[312,1966,1967,1969,1971,1973,1975,1978,1980],{"class":314,"line":346},[312,1968,590],{"class":434},[312,1970,593],{"class":438},[312,1972,596],{"class":445},[312,1974,599],{"class":502},[312,1976,1977],{"class":438},"(evlog",[312,1979,629],{"class":445},[312,1981,648],{"class":445},[312,1983,1984,1987,1989,1991,1994],{"class":314,"line":352},[312,1985,1986],{"class":514},"  drain",[312,1988,518],{"class":445},[312,1990,1912],{"class":502},[312,1992,1993],{"class":438},"()",[312,1995,1601],{"class":445},[312,1997,1998,2001,2003,2005,2008,2010,2012],{"class":314,"line":358},[312,1999,2000],{"class":502},"  enrich",[312,2002,518],{"class":445},[312,2004,635],{"class":445},[312,2006,2007],{"class":638},"ctx",[312,2009,642],{"class":445},[312,2011,645],{"class":553},[312,2013,648],{"class":445},[312,2015,2016,2019,2021,2023],{"class":314,"line":364},[312,2017,2018],{"class":502},"    userAgent",[312,2020,506],{"class":514},[312,2022,2007],{"class":438},[312,2024,544],{"class":514},[312,2026,2027,2030,2032,2035,2037,2040,2042,2045,2047,2050,2052],{"class":314,"line":370},[312,2028,2029],{"class":438},"    ctx",[312,2031,596],{"class":445},[312,2033,2034],{"class":438},"event",[312,2036,596],{"class":445},[312,2038,2039],{"class":438},"region",[312,2041,835],{"class":445},[312,2043,2044],{"class":438}," process",[312,2046,596],{"class":445},[312,2048,2049],{"class":438},"env",[312,2051,596],{"class":445},[312,2053,2054],{"class":438},"FLY_REGION\n",[312,2056,2057],{"class":314,"line":375},[312,2058,2059],{"class":445},"  },\n",[312,2061,2062,2064],{"class":314,"line":381},[312,2063,541],{"class":445},[312,2065,544],{"class":438},[390,2067,2069],{"id":2068},"pipeline-batching-retry","Pipeline (Batching & Retry)",[282,2071,2072,2073,2076],{},"For production, wrap your adapter with ",[286,2074,2075],{},"createDrainPipeline"," to batch events and retry on failure:",[302,2078,2080],{"className":424,"code":2079,"filename":426,"language":427,"meta":308,"style":308},"import type { DrainContext } from 'evlog'\nimport { createAxiomDrain } from 'evlog\u002Faxiom'\nimport { createDrainPipeline } from 'evlog\u002Fpipeline'\n\nconst pipeline = createDrainPipeline\u003CDrainContext>({\n  batch: { size: 50, intervalMs: 5000 },\n  retry: { maxAttempts: 3 },\n})\nconst drain = pipeline(createAxiomDrain())\n\nawait app.register(evlog, { drain })\n",[286,2081,2082,2104,2122,2142,2146,2170,2199,2218,2224,2244,2248],{"__ignoreMap":308},[312,2083,2084,2086,2089,2091,2094,2096,2098,2100,2102],{"class":314,"line":315},[312,2085,435],{"class":434},[312,2087,2088],{"class":434}," type",[312,2090,459],{"class":445},[312,2092,2093],{"class":438}," DrainContext",[312,2095,465],{"class":445},[312,2097,468],{"class":434},[312,2099,446],{"class":445},[312,2101,473],{"class":410},[312,2103,452],{"class":445},[312,2105,2106,2108,2110,2112,2114,2116,2118,2120],{"class":314,"line":321},[312,2107,435],{"class":434},[312,2109,459],{"class":445},[312,2111,1912],{"class":438},[312,2113,465],{"class":445},[312,2115,468],{"class":434},[312,2117,446],{"class":445},[312,2119,1921],{"class":410},[312,2121,452],{"class":445},[312,2123,2124,2126,2128,2131,2133,2135,2137,2140],{"class":314,"line":328},[312,2125,435],{"class":434},[312,2127,459],{"class":445},[312,2129,2130],{"class":438}," createDrainPipeline",[312,2132,465],{"class":445},[312,2134,468],{"class":434},[312,2136,446],{"class":445},[312,2138,2139],{"class":410},"evlog\u002Fpipeline",[312,2141,452],{"class":445},[312,2143,2144],{"class":314,"line":334},[312,2145,325],{"emptyLinePlaceholder":324},[312,2147,2148,2150,2153,2155,2157,2160,2163,2166,2168],{"class":314,"line":340},[312,2149,554],{"class":553},[312,2151,2152],{"class":438}," pipeline ",[312,2154,560],{"class":445},[312,2156,2130],{"class":502},[312,2158,2159],{"class":445},"\u003C",[312,2161,2162],{"class":406},"DrainContext",[312,2164,2165],{"class":445},">",[312,2167,506],{"class":438},[312,2169,509],{"class":445},[312,2171,2172,2175,2177,2179,2182,2184,2187,2189,2192,2194,2197],{"class":314,"line":346},[312,2173,2174],{"class":514},"  batch",[312,2176,518],{"class":445},[312,2178,459],{"class":445},[312,2180,2181],{"class":514}," size",[312,2183,518],{"class":445},[312,2185,2186],{"class":739}," 50",[312,2188,629],{"class":445},[312,2190,2191],{"class":514}," intervalMs",[312,2193,518],{"class":445},[312,2195,2196],{"class":739}," 5000",[312,2198,536],{"class":445},[312,2200,2201,2204,2206,2208,2211,2213,2216],{"class":314,"line":352},[312,2202,2203],{"class":514},"  retry",[312,2205,518],{"class":445},[312,2207,459],{"class":445},[312,2209,2210],{"class":514}," maxAttempts",[312,2212,518],{"class":445},[312,2214,2215],{"class":739}," 3",[312,2217,536],{"class":445},[312,2219,2220,2222],{"class":314,"line":358},[312,2221,541],{"class":445},[312,2223,544],{"class":438},[312,2225,2226,2228,2231,2233,2236,2238,2241],{"class":314,"line":364},[312,2227,554],{"class":553},[312,2229,2230],{"class":438}," drain ",[312,2232,560],{"class":445},[312,2234,2235],{"class":502}," pipeline",[312,2237,506],{"class":438},[312,2239,2240],{"class":502},"createAxiomDrain",[312,2242,2243],{"class":438},"())\n",[312,2245,2246],{"class":314,"line":370},[312,2247,325],{"emptyLinePlaceholder":324},[312,2249,2250,2252,2254,2256,2258,2260,2262,2264,2266,2268],{"class":314,"line":375},[312,2251,590],{"class":434},[312,2253,593],{"class":438},[312,2255,596],{"class":445},[312,2257,599],{"class":502},[312,2259,1977],{"class":438},[312,2261,629],{"class":445},[312,2263,459],{"class":445},[312,2265,2230],{"class":438},[312,2267,541],{"class":445},[312,2269,544],{"class":438},[746,2271,2272,2273,2276,2277,2280],{"color":748,"icon":13},"Call ",[286,2274,2275],{},"drain.flush()"," on server shutdown to ensure all buffered events are sent. See the ",[755,2278,2279],{"href":198},"Pipeline docs"," for all options.",[386,2282,2284],{"id":2283},"tail-sampling","Tail Sampling",[282,2286,1159,2287,2290],{},[286,2288,2289],{},"keep"," to force-retain specific events regardless of head sampling:",[302,2292,2294],{"className":424,"code":2293,"filename":426,"language":427,"meta":308,"style":308},"await app.register(evlog, {\n  drain: createAxiomDrain(),\n  keep: (ctx) => {\n    if (ctx.duration && ctx.duration > 2000) ctx.shouldKeep = true\n  },\n})\n",[286,2295,2296,2312,2324,2341,2385,2389],{"__ignoreMap":308},[312,2297,2298,2300,2302,2304,2306,2308,2310],{"class":314,"line":315},[312,2299,590],{"class":434},[312,2301,593],{"class":438},[312,2303,596],{"class":445},[312,2305,599],{"class":502},[312,2307,1977],{"class":438},[312,2309,629],{"class":445},[312,2311,648],{"class":445},[312,2313,2314,2316,2318,2320,2322],{"class":314,"line":321},[312,2315,1986],{"class":514},[312,2317,518],{"class":445},[312,2319,1912],{"class":502},[312,2321,1993],{"class":438},[312,2323,1601],{"class":445},[312,2325,2326,2329,2331,2333,2335,2337,2339],{"class":314,"line":328},[312,2327,2328],{"class":502},"  keep",[312,2330,518],{"class":445},[312,2332,635],{"class":445},[312,2334,2007],{"class":638},[312,2336,642],{"class":445},[312,2338,645],{"class":553},[312,2340,648],{"class":445},[312,2342,2343,2346,2348,2350,2352,2355,2358,2361,2363,2365,2368,2371,2373,2375,2377,2380,2382],{"class":314,"line":334},[312,2344,2345],{"class":434},"    if",[312,2347,635],{"class":514},[312,2349,2007],{"class":438},[312,2351,596],{"class":445},[312,2353,2354],{"class":438},"duration",[312,2356,2357],{"class":445}," &&",[312,2359,2360],{"class":438}," ctx",[312,2362,596],{"class":445},[312,2364,2354],{"class":438},[312,2366,2367],{"class":445}," >",[312,2369,2370],{"class":739}," 2000",[312,2372,1056],{"class":514},[312,2374,2007],{"class":438},[312,2376,596],{"class":445},[312,2378,2379],{"class":438},"shouldKeep",[312,2381,835],{"class":445},[312,2383,2384],{"class":576}," true\n",[312,2386,2387],{"class":314,"line":340},[312,2388,2059],{"class":445},[312,2390,2391,2393],{"class":314,"line":346},[312,2392,541],{"class":445},[312,2394,544],{"class":438},[386,2396,2398],{"id":2397},"route-filtering","Route Filtering",[282,2400,2401,2402,293,2405,2408],{},"Control which routes are logged with ",[286,2403,2404],{},"include",[286,2406,2407],{},"exclude"," patterns:",[302,2410,2412],{"className":424,"code":2411,"filename":426,"language":427,"meta":308,"style":308},"await app.register(evlog, {\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",[286,2413,2414,2430,2452,2480,2489,2516,2542,2546],{"__ignoreMap":308},[312,2415,2416,2418,2420,2422,2424,2426,2428],{"class":314,"line":315},[312,2417,590],{"class":434},[312,2419,593],{"class":438},[312,2421,596],{"class":445},[312,2423,599],{"class":502},[312,2425,1977],{"class":438},[312,2427,629],{"class":445},[312,2429,648],{"class":445},[312,2431,2432,2435,2437,2440,2442,2445,2447,2450],{"class":314,"line":321},[312,2433,2434],{"class":514},"  include",[312,2436,518],{"class":445},[312,2438,2439],{"class":438}," [",[312,2441,533],{"class":445},[312,2443,2444],{"class":410},"\u002Fapi\u002F**",[312,2446,533],{"class":445},[312,2448,2449],{"class":438},"]",[312,2451,1601],{"class":445},[312,2453,2454,2457,2459,2461,2463,2466,2468,2470,2472,2474,2476,2478],{"class":314,"line":328},[312,2455,2456],{"class":514},"  exclude",[312,2458,518],{"class":445},[312,2460,2439],{"class":438},[312,2462,533],{"class":445},[312,2464,2465],{"class":410},"\u002F_internal\u002F**",[312,2467,533],{"class":445},[312,2469,629],{"class":445},[312,2471,446],{"class":445},[312,2473,624],{"class":410},[312,2475,533],{"class":445},[312,2477,2449],{"class":438},[312,2479,1601],{"class":445},[312,2481,2482,2485,2487],{"class":314,"line":334},[312,2483,2484],{"class":514},"  routes",[312,2486,518],{"class":445},[312,2488,648],{"class":445},[312,2490,2491,2494,2497,2499,2501,2503,2505,2507,2509,2512,2514],{"class":314,"line":340},[312,2492,2493],{"class":445},"    '",[312,2495,2496],{"class":514},"\u002Fapi\u002Fauth\u002F**",[312,2498,533],{"class":445},[312,2500,518],{"class":445},[312,2502,459],{"class":445},[312,2504,523],{"class":514},[312,2506,518],{"class":445},[312,2508,446],{"class":445},[312,2510,2511],{"class":410},"auth-service",[312,2513,533],{"class":445},[312,2515,536],{"class":445},[312,2517,2518,2520,2523,2525,2527,2529,2531,2533,2535,2538,2540],{"class":314,"line":346},[312,2519,2493],{"class":445},[312,2521,2522],{"class":514},"\u002Fapi\u002Fpayment\u002F**",[312,2524,533],{"class":445},[312,2526,518],{"class":445},[312,2528,459],{"class":445},[312,2530,523],{"class":514},[312,2532,518],{"class":445},[312,2534,446],{"class":445},[312,2536,2537],{"class":410},"payment-service",[312,2539,533],{"class":445},[312,2541,536],{"class":445},[312,2543,2544],{"class":314,"line":352},[312,2545,2059],{"class":445},[312,2547,2548,2550],{"class":314,"line":358},[312,2549,541],{"class":445},[312,2551,544],{"class":438},[386,2553,2555],{"id":2554},"run-locally","Run Locally",[302,2557,2559],{"className":396,"code":2558,"filename":398,"language":399,"meta":308,"style":308},"git clone https:\u002F\u002Fgithub.com\u002Fhugorcd\u002Fevlog.git\ncd evlog\nbun install\nbun run example:fastify\n",[286,2560,2561,2572,2580,2587],{"__ignoreMap":308},[312,2562,2563,2566,2569],{"class":314,"line":315},[312,2564,2565],{"class":406},"git",[312,2567,2568],{"class":410}," clone",[312,2570,2571],{"class":410}," https:\u002F\u002Fgithub.com\u002Fhugorcd\u002Fevlog.git\n",[312,2573,2574,2577],{"class":314,"line":321},[312,2575,2576],{"class":502},"cd",[312,2578,2579],{"class":410}," evlog\n",[312,2581,2582,2584],{"class":314,"line":328},[312,2583,407],{"class":406},[312,2585,2586],{"class":410}," install\n",[312,2588,2589,2591,2594],{"class":314,"line":334},[312,2590,407],{"class":406},[312,2592,2593],{"class":410}," run",[312,2595,2596],{"class":410}," example:fastify\n",[282,2598,2599,2600,2605],{},"Open ",[755,2601,2602],{"href":2602,"rel":2603},"http:\u002F\u002Flocalhost:3000",[2604],"nofollow"," to explore the interactive test UI.",[2607,2608,2609],"card-group",{},[2610,2611,2615],"card",{"icon":2612,"title":2613,"to":2614},"i-simple-icons-github","Source Code","https:\u002F\u002Fgithub.com\u002Fhugorcd\u002Fevlog\u002Ftree\u002Fmain\u002Fexamples\u002Ffastify","Browse the complete Fastify example source on GitHub.",[386,2617,2619],{"id":2618},"next-steps","Next Steps",[2621,2622,2623,2629,2634,2639],"ul",{},[2624,2625,2626,2628],"li",{},[755,2627,46],{"href":47},": Design comprehensive events with context layering",[2624,2630,2631,2633],{},[755,2632,188],{"href":193},": Send logs to Axiom, Sentry, PostHog, and more",[2624,2635,2636,2638],{},[755,2637,81],{"href":82},": Control log volume with head and tail sampling",[2624,2640,2641,2643,2644,1492,2646,1496,2648,2650],{},[755,2642,51],{"href":52},": Throw errors with ",[286,2645,1491],{},[286,2647,1495],{},[286,2649,1499],{}," fields",[2652,2653,2654],"style",{},"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 .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 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 .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}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 .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}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}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":308,"searchDepth":321,"depth":321,"links":2656},[2657,2661,2662,2663,2664,2665,2668,2669,2670,2671],{"id":388,"depth":321,"text":20,"children":2658},[2659,2660],{"id":392,"depth":328,"text":393},{"id":420,"depth":328,"text":421},{"id":781,"depth":321,"text":46},{"id":1156,"depth":321,"text":296},{"id":1481,"depth":321,"text":1482},{"id":1881,"depth":321,"text":76},{"id":1894,"depth":321,"text":1895,"children":2666},[2667],{"id":2068,"depth":328,"text":2069},{"id":2283,"depth":321,"text":2284},{"id":2397,"depth":321,"text":2398},{"id":2554,"depth":321,"text":2555},{"id":2618,"depth":321,"text":2619},"Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in Fastify applications.","md",[2675],{"label":2613,"icon":2612,"to":2614,"color":2676,"variant":2677},"neutral","subtle",{},{"title":155,"icon":158},{"title":155,"description":2672},"I3oQpuUfQRBYoVaKMAGPzIWtc-CB6DCHVdenwPRUE3k",[2683,2685],{"title":150,"path":151,"stem":152,"description":2684,"icon":153,"children":-1},"Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in Hono applications.",{"title":160,"path":161,"stem":162,"description":2686,"icon":163,"children":-1},"Automatic wide events, structured errors, drain adapters, enrichers, and tail sampling in Elysia applications.",1775288556349]