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