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