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