[{"data":1,"prerenderedAt":2462},["ShallowReactive",2],{"navigation_docs":3,"-adapters-building-blocks-pipeline":308,"-adapters-building-blocks-pipeline-surround":2457},[4,35,80,124,212,292],{"title":5,"path":6,"stem":7,"children":8,"page":34},"Getting Started","\u002Fgetting-started","1.getting-started",[9,14,19,24,29],{"title":10,"path":11,"stem":12,"icon":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction","i-lucide-info",{"title":15,"path":16,"stem":17,"icon":18},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation","i-lucide-download",{"title":20,"path":21,"stem":22,"icon":23},"Quick Start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start","i-lucide-zap",{"title":25,"path":26,"stem":27,"icon":28},"Agent Skills","\u002Fgetting-started\u002Fagent-skills","1.getting-started\u002F4.agent-skills","i-lucide-sparkles",{"title":30,"path":31,"stem":32,"icon":33},"vs Other Loggers","\u002Fgetting-started\u002Fvs-other-loggers","1.getting-started\u002F5.vs-other-loggers","i-lucide-scale",false,{"title":36,"path":37,"stem":38,"children":39,"page":34},"Logging","\u002Flogging","2.logging",[40,45,50,55,60,65,70,75],{"title":41,"path":42,"stem":43,"icon":44},"Overview","\u002Flogging\u002Foverview","2.logging\u002F0.overview","i-lucide-list",{"title":46,"path":47,"stem":48,"icon":49},"Simple Logging","\u002Flogging\u002Fsimple-logging","2.logging\u002F1.simple-logging","i-lucide-terminal",{"title":51,"path":52,"stem":53,"icon":54},"Wide Events","\u002Flogging\u002Fwide-events","2.logging\u002F2.wide-events","i-lucide-layers",{"title":56,"path":57,"stem":58,"icon":59},"Structured Errors","\u002Flogging\u002Fstructured-errors","2.logging\u002F3.structured-errors","i-lucide-shield-alert",{"title":61,"path":62,"stem":63,"icon":64},"Client Logging","\u002Flogging\u002Fclient-logging","2.logging\u002F4.client-logging","i-lucide-monitor",{"title":66,"path":67,"stem":68,"icon":69},"AI SDK Integration","\u002Flogging\u002Fai-sdk","2.logging\u002F5.ai-sdk","i-simple-icons-vercel",{"title":71,"path":72,"stem":73,"icon":74},"Better Auth Integration","\u002Flogging\u002Fbetter-auth","2.logging\u002F6.better-auth","i-simple-icons-betterauth",{"title":76,"path":77,"stem":78,"icon":79},"Audit Logs","\u002Flogging\u002Faudit","2.logging\u002F7.audit","i-lucide-shield-check",{"title":81,"path":82,"stem":83,"children":84,"page":34},"Core Concepts","\u002Fcore-concepts","3.core-concepts",[85,90,95,100,105,109,114,119],{"title":86,"path":87,"stem":88,"icon":89},"Lifecycle","\u002Fcore-concepts\u002Flifecycle","3.core-concepts\u002F0.lifecycle","i-lucide-arrow-right-left",{"title":91,"path":92,"stem":93,"icon":94},"Configuration","\u002Fcore-concepts\u002Fconfiguration","3.core-concepts\u002F1.configuration","i-lucide-settings",{"title":96,"path":97,"stem":98,"icon":99},"Sampling","\u002Fcore-concepts\u002Fsampling","3.core-concepts\u002F2.sampling","i-lucide-filter",{"title":101,"path":102,"stem":103,"icon":104},"Typed Fields","\u002Fcore-concepts\u002Ftyped-fields","3.core-concepts\u002F3.typed-fields","i-simple-icons-typescript",{"title":106,"path":107,"stem":108,"icon":79},"Best Practices","\u002Fcore-concepts\u002Fbest-practices","3.core-concepts\u002F4.best-practices",{"title":110,"path":111,"stem":112,"icon":113},"Performance","\u002Fcore-concepts\u002Fperformance","3.core-concepts\u002F5.performance","i-lucide-gauge",{"title":115,"path":116,"stem":117,"icon":118},"Vite Plugin","\u002Fcore-concepts\u002Fvite-plugin","3.core-concepts\u002F6.vite-plugin","i-custom-vite",{"title":120,"path":121,"stem":122,"icon":123},"Auto-Redaction","\u002Fcore-concepts\u002Fredaction","3.core-concepts\u002F7.redaction","i-lucide-eye-off",{"title":125,"path":126,"stem":127,"children":128,"page":34},"Frameworks","\u002Fframeworks","4.frameworks",[129,133,138,143,148,153,158,163,168,173,178,183,188,193,197,202,207],{"title":41,"path":130,"stem":131,"icon":132},"\u002Fframeworks\u002Foverview","4.frameworks\u002F00.overview","i-lucide-layout-grid",{"title":134,"path":135,"stem":136,"icon":137},"Nuxt","\u002Fframeworks\u002Fnuxt","4.frameworks\u002F01.nuxt","i-simple-icons-nuxtdotjs",{"title":139,"path":140,"stem":141,"icon":142},"Next.js","\u002Fframeworks\u002Fnextjs","4.frameworks\u002F02.nextjs","i-simple-icons-nextdotjs",{"title":144,"path":145,"stem":146,"icon":147},"SvelteKit","\u002Fframeworks\u002Fsveltekit","4.frameworks\u002F03.sveltekit","i-simple-icons-svelte",{"title":149,"path":150,"stem":151,"icon":152},"Nitro","\u002Fframeworks\u002Fnitro","4.frameworks\u002F04.nitro","i-custom-nitro",{"title":154,"path":155,"stem":156,"icon":157},"TanStack Start","\u002Fframeworks\u002Ftanstack-start","4.frameworks\u002F05.tanstack-start","i-custom-tanstack",{"title":159,"path":160,"stem":161,"icon":162},"NestJS","\u002Fframeworks\u002Fnestjs","4.frameworks\u002F06.nestjs","i-simple-icons-nestjs",{"title":164,"path":165,"stem":166,"icon":167},"Express","\u002Fframeworks\u002Fexpress","4.frameworks\u002F07.express","i-simple-icons-express",{"title":169,"path":170,"stem":171,"icon":172},"Hono","\u002Fframeworks\u002Fhono","4.frameworks\u002F08.hono","i-simple-icons-hono",{"title":174,"path":175,"stem":176,"icon":177},"Fastify","\u002Fframeworks\u002Ffastify","4.frameworks\u002F09.fastify","i-simple-icons-fastify",{"title":179,"path":180,"stem":181,"icon":182},"Elysia","\u002Fframeworks\u002Felysia","4.frameworks\u002F10.elysia","i-custom-elysia",{"title":184,"path":185,"stem":186,"icon":187},"React Router","\u002Fframeworks\u002Freact-router","4.frameworks\u002F11.react-router","i-custom-reactrouter",{"title":189,"path":190,"stem":191,"icon":192},"Cloudflare Workers","\u002Fframeworks\u002Fcloudflare-workers","4.frameworks\u002F12.cloudflare-workers","i-simple-icons-cloudflare",{"title":194,"path":195,"stem":196,"icon":104},"Standalone","\u002Fframeworks\u002Fstandalone","4.frameworks\u002F13.standalone",{"title":198,"path":199,"stem":200,"icon":201},"Astro","\u002Fframeworks\u002Fastro","4.frameworks\u002F14.astro","i-simple-icons-astro",{"title":203,"path":204,"stem":205,"icon":206},"AWS Lambda","\u002Fframeworks\u002Faws-lambda","4.frameworks\u002F16.aws-lambda","i-custom-lambda",{"title":208,"path":209,"stem":210,"icon":211},"Custom Integration","\u002Fframeworks\u002Fcustom-integration","4.frameworks\u002F17.custom-integration","i-lucide-puzzle",{"title":213,"path":214,"stem":215,"children":216,"page":34},"Adapters","\u002Fadapters","6.adapters",[217,257,272],{"title":218,"path":219,"stem":220,"children":221,"page":34},"Cloud destinations","\u002Fadapters\u002Fcloud","6.adapters\u002F02.cloud",[222,227,232,237,242,247,252],{"title":223,"path":224,"stem":225,"icon":226},"Axiom","\u002Fadapters\u002Fcloud\u002Faxiom","6.adapters\u002F02.cloud\u002F01.axiom","i-custom-axiom",{"title":228,"path":229,"stem":230,"icon":231},"OTLP","\u002Fadapters\u002Fcloud\u002Fotlp","6.adapters\u002F02.cloud\u002F02.otlp","i-simple-icons-opentelemetry",{"title":233,"path":234,"stem":235,"icon":236},"PostHog","\u002Fadapters\u002Fcloud\u002Fposthog","6.adapters\u002F02.cloud\u002F03.posthog","i-simple-icons-posthog",{"title":238,"path":239,"stem":240,"icon":241},"Sentry","\u002Fadapters\u002Fcloud\u002Fsentry","6.adapters\u002F02.cloud\u002F04.sentry","i-simple-icons-sentry",{"title":243,"path":244,"stem":245,"icon":246},"Better Stack","\u002Fadapters\u002Fcloud\u002Fbetter-stack","6.adapters\u002F02.cloud\u002F05.better-stack","i-simple-icons-betterstack",{"title":248,"path":249,"stem":250,"icon":251},"Datadog","\u002Fadapters\u002Fcloud\u002Fdatadog","6.adapters\u002F02.cloud\u002F06.datadog","i-simple-icons-datadog",{"title":253,"path":254,"stem":255,"icon":256},"HyperDX","\u002Fadapters\u002Fcloud\u002Fhyperdx","6.adapters\u002F02.cloud\u002F07.hyperdx","i-custom-hyperdx",{"title":258,"path":259,"stem":260,"children":261,"page":34},"Self-hosted","\u002Fadapters\u002Fself-hosted","6.adapters\u002F03.self-hosted",[262,267],{"title":263,"path":264,"stem":265,"icon":266},"File System","\u002Fadapters\u002Fself-hosted\u002Ffs","6.adapters\u002F03.self-hosted\u002F01.fs","i-lucide-hard-drive",{"title":268,"path":269,"stem":270,"icon":271},"NuxtHub","\u002Fadapters\u002Fself-hosted\u002Fnuxthub","6.adapters\u002F03.self-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":273,"path":274,"stem":275,"children":276,"page":34},"Building blocks","\u002Fadapters\u002Fbuilding-blocks","6.adapters\u002F04.building-blocks",[277,282,287],{"title":278,"path":279,"stem":280,"icon":281},"Pipeline","\u002Fadapters\u002Fbuilding-blocks\u002Fpipeline","6.adapters\u002F04.building-blocks\u002F01.pipeline","i-lucide-workflow",{"title":283,"path":284,"stem":285,"icon":286},"HTTP","\u002Fadapters\u002Fbuilding-blocks\u002Fhttp","6.adapters\u002F04.building-blocks\u002F02.http","i-lucide-globe",{"title":288,"path":289,"stem":290,"icon":291},"Custom Adapters","\u002Fadapters\u002Fbuilding-blocks\u002Fcustom","6.adapters\u002F04.building-blocks\u002F03.custom","i-lucide-code",{"title":293,"path":294,"stem":295,"children":296,"page":34},"Enrichers","\u002Fenrichers","7.enrichers",[297,300,304],{"title":41,"path":298,"stem":299,"icon":28},"\u002Fenrichers\u002Foverview","7.enrichers\u002F1.overview",{"title":301,"path":302,"stem":303,"icon":211},"Built-in","\u002Fenrichers\u002Fbuilt-in","7.enrichers\u002F2.built-in",{"title":305,"path":306,"stem":307,"icon":291},"Custom","\u002Fenrichers\u002Fcustom","7.enrichers\u002F3.custom",{"id":309,"title":310,"body":311,"description":2446,"extension":2447,"links":2448,"meta":2453,"navigation":2454,"path":279,"seo":2455,"stem":280,"__hash__":2456},"docs\u002F6.adapters\u002F04.building-blocks\u002F01.pipeline.md","Drain Pipeline",{"type":312,"value":313,"toc":2434},"minimark",[314,318,366,370,373,1242,1262,1266,1307,1310,1320,1642,1647,1793,1797,1852,1856,1863,1923,1927,1930,2140,2144,2147,2392,2407,2411,2430],[315,316,317],"p",{},"In production, sending one HTTP request per log event is wasteful. The drain pipeline buffers events and sends them in batches, retries on transient failures, and drops the oldest events when the buffer overflows.",[319,320,323,326,352],"prompt",{":actions":321,"description":322,"icon":281},"[\"copy\",\"cursor\",\"windsurf\"]","Add the drain pipeline (batch + retry + fan-out)",[315,324,325],{},"Wrap my evlog drain in the shared pipeline (batch + retry + buffer overflow protection).",[327,328,329,333,336,343,346,349],"ul",{},[330,331,332],"li",{},"Identify my framework and follow its evlog wiring pattern",[330,334,335],{},"Import createDrainPipeline from 'evlog\u002Fpipeline' and the adapter (e.g. evlog\u002Faxiom)",[330,337,338,339],{},"Wrap the adapter: const drain = createDrainPipeline",[340,341,342],"drain-context",{},"()(createAxiomDrain())",[330,344,345],{},"Configure batch ({ size, intervalMs }), retry ({ maxAttempts, backoff }), and bufferSize options",[330,347,348],{},"Use fan-out to send to multiple drains at once: pipeline(...adapters)",[330,350,351],{},"Hook drain.flush() on framework close \u002F SIGTERM so buffered events aren't lost on shutdown",[315,353,354,355,361,362],{},"Docs: ",[356,357,358],"a",{"href":358,"rel":359},"https:\u002F\u002Fwww.evlog.dev\u002Fadapters\u002Fbuilding-blocks\u002Fpipeline",[360],"nofollow","\nAdapters: ",[356,363,364],{"href":364,"rel":365},"https:\u002F\u002Fwww.evlog.dev\u002Fadapters\u002Foverview",[360],[367,368,20],"h2",{"id":369},"quick-start",[315,371,372],{},"The pipeline wraps any drain. The wiring depends on your framework — pick the tab that matches yours; every other example below uses the same shape.",[374,375,376,645,882,1078],"code-group",{},[377,378,384],"pre",{"className":379,"code":380,"filename":381,"language":382,"meta":383,"style":383},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F server\u002Fplugins\u002Fevlog-drain.ts\nimport type { DrainContext } from 'evlog'\nimport { createDrainPipeline } from 'evlog\u002Fpipeline'\nimport { createAxiomDrain } from 'evlog\u002Faxiom'\n\nexport default defineNitroPlugin((nitroApp) => {\n  const pipeline = createDrainPipeline\u003CDrainContext>()\n  const drain = pipeline(createAxiomDrain())\n\n  nitroApp.hooks.hook('evlog:drain', drain)\n  nitroApp.hooks.hook('close', () => drain.flush())\n})\n","Nuxt \u002F Nitro","typescript","",[385,386,387,396,430,451,472,479,511,539,559,564,599,637],"code",{"__ignoreMap":383},[388,389,392],"span",{"class":390,"line":391},"line",1,[388,393,395],{"class":394},"sHwdD","\u002F\u002F server\u002Fplugins\u002Fevlog-drain.ts\n",[388,397,399,403,406,410,414,417,420,423,427],{"class":390,"line":398},2,[388,400,402],{"class":401},"s7zQu","import",[388,404,405],{"class":401}," type",[388,407,409],{"class":408},"sMK4o"," {",[388,411,413],{"class":412},"sTEyZ"," DrainContext",[388,415,416],{"class":408}," }",[388,418,419],{"class":401}," from",[388,421,422],{"class":408}," '",[388,424,426],{"class":425},"sfazB","evlog",[388,428,429],{"class":408},"'\n",[388,431,433,435,437,440,442,444,446,449],{"class":390,"line":432},3,[388,434,402],{"class":401},[388,436,409],{"class":408},[388,438,439],{"class":412}," createDrainPipeline",[388,441,416],{"class":408},[388,443,419],{"class":401},[388,445,422],{"class":408},[388,447,448],{"class":425},"evlog\u002Fpipeline",[388,450,429],{"class":408},[388,452,454,456,458,461,463,465,467,470],{"class":390,"line":453},4,[388,455,402],{"class":401},[388,457,409],{"class":408},[388,459,460],{"class":412}," createAxiomDrain",[388,462,416],{"class":408},[388,464,419],{"class":401},[388,466,422],{"class":408},[388,468,469],{"class":425},"evlog\u002Faxiom",[388,471,429],{"class":408},[388,473,475],{"class":390,"line":474},5,[388,476,478],{"emptyLinePlaceholder":477},true,"\n",[388,480,482,485,488,492,495,497,501,504,508],{"class":390,"line":481},6,[388,483,484],{"class":401},"export",[388,486,487],{"class":401}," default",[388,489,491],{"class":490},"s2Zo4"," defineNitroPlugin",[388,493,494],{"class":412},"(",[388,496,494],{"class":408},[388,498,500],{"class":499},"sHdIc","nitroApp",[388,502,503],{"class":408},")",[388,505,507],{"class":506},"spNyl"," =>",[388,509,510],{"class":408}," {\n",[388,512,514,517,520,523,525,528,532,535],{"class":390,"line":513},7,[388,515,516],{"class":506},"  const",[388,518,519],{"class":412}," pipeline",[388,521,522],{"class":408}," =",[388,524,439],{"class":490},[388,526,527],{"class":408},"\u003C",[388,529,531],{"class":530},"sBMFI","DrainContext",[388,533,534],{"class":408},">",[388,536,538],{"class":537},"swJcz","()\n",[388,540,542,544,547,549,551,553,556],{"class":390,"line":541},8,[388,543,516],{"class":506},[388,545,546],{"class":412}," drain",[388,548,522],{"class":408},[388,550,519],{"class":490},[388,552,494],{"class":537},[388,554,555],{"class":490},"createAxiomDrain",[388,557,558],{"class":537},"())\n",[388,560,562],{"class":390,"line":561},9,[388,563,478],{"emptyLinePlaceholder":477},[388,565,567,570,573,576,578,581,583,586,589,591,594,596],{"class":390,"line":566},10,[388,568,569],{"class":412},"  nitroApp",[388,571,572],{"class":408},".",[388,574,575],{"class":412},"hooks",[388,577,572],{"class":408},[388,579,580],{"class":490},"hook",[388,582,494],{"class":537},[388,584,585],{"class":408},"'",[388,587,588],{"class":425},"evlog:drain",[388,590,585],{"class":408},[388,592,593],{"class":408},",",[388,595,546],{"class":412},[388,597,598],{"class":537},")\n",[388,600,602,604,606,608,610,612,614,616,619,621,623,626,628,630,632,635],{"class":390,"line":601},11,[388,603,569],{"class":412},[388,605,572],{"class":408},[388,607,575],{"class":412},[388,609,572],{"class":408},[388,611,580],{"class":490},[388,613,494],{"class":537},[388,615,585],{"class":408},[388,617,618],{"class":425},"close",[388,620,585],{"class":408},[388,622,593],{"class":408},[388,624,625],{"class":408}," ()",[388,627,507],{"class":506},[388,629,546],{"class":412},[388,631,572],{"class":408},[388,633,634],{"class":490},"flush",[388,636,558],{"class":537},[388,638,640,643],{"class":390,"line":639},12,[388,641,642],{"class":408},"}",[388,644,598],{"class":412},[377,646,648],{"className":379,"code":647,"filename":139,"language":382,"meta":383,"style":383},"\u002F\u002F lib\u002Fevlog.ts\nimport type { DrainContext } from 'evlog'\nimport { createEvlog } from 'evlog\u002Fnext'\nimport { createDrainPipeline } from 'evlog\u002Fpipeline'\nimport { createAxiomDrain } from 'evlog\u002Faxiom'\n\nconst pipeline = createDrainPipeline\u003CDrainContext>()\nconst drain = pipeline(createAxiomDrain())\n\nexport const { withEvlog, useLogger, log, createError } = createEvlog({\n  service: 'my-app',\n  drain,\n})\n\n\u002F\u002F Flush before shutdown (e.g. from your custom server or a teardown hook)\nexport const flushEvlog = () => drain.flush()\n",[385,649,650,655,675,695,713,731,735,756,773,777,815,833,840,847,852,858],{"__ignoreMap":383},[388,651,652],{"class":390,"line":391},[388,653,654],{"class":394},"\u002F\u002F lib\u002Fevlog.ts\n",[388,656,657,659,661,663,665,667,669,671,673],{"class":390,"line":398},[388,658,402],{"class":401},[388,660,405],{"class":401},[388,662,409],{"class":408},[388,664,413],{"class":412},[388,666,416],{"class":408},[388,668,419],{"class":401},[388,670,422],{"class":408},[388,672,426],{"class":425},[388,674,429],{"class":408},[388,676,677,679,681,684,686,688,690,693],{"class":390,"line":432},[388,678,402],{"class":401},[388,680,409],{"class":408},[388,682,683],{"class":412}," createEvlog",[388,685,416],{"class":408},[388,687,419],{"class":401},[388,689,422],{"class":408},[388,691,692],{"class":425},"evlog\u002Fnext",[388,694,429],{"class":408},[388,696,697,699,701,703,705,707,709,711],{"class":390,"line":453},[388,698,402],{"class":401},[388,700,409],{"class":408},[388,702,439],{"class":412},[388,704,416],{"class":408},[388,706,419],{"class":401},[388,708,422],{"class":408},[388,710,448],{"class":425},[388,712,429],{"class":408},[388,714,715,717,719,721,723,725,727,729],{"class":390,"line":474},[388,716,402],{"class":401},[388,718,409],{"class":408},[388,720,460],{"class":412},[388,722,416],{"class":408},[388,724,419],{"class":401},[388,726,422],{"class":408},[388,728,469],{"class":425},[388,730,429],{"class":408},[388,732,733],{"class":390,"line":481},[388,734,478],{"emptyLinePlaceholder":477},[388,736,737,740,743,746,748,750,752,754],{"class":390,"line":513},[388,738,739],{"class":506},"const",[388,741,742],{"class":412}," pipeline ",[388,744,745],{"class":408},"=",[388,747,439],{"class":490},[388,749,527],{"class":408},[388,751,531],{"class":530},[388,753,534],{"class":408},[388,755,538],{"class":412},[388,757,758,760,763,765,767,769,771],{"class":390,"line":541},[388,759,739],{"class":506},[388,761,762],{"class":412}," drain ",[388,764,745],{"class":408},[388,766,519],{"class":490},[388,768,494],{"class":412},[388,770,555],{"class":490},[388,772,558],{"class":412},[388,774,775],{"class":390,"line":561},[388,776,478],{"emptyLinePlaceholder":477},[388,778,779,781,784,786,789,791,794,796,799,801,804,806,808,810,812],{"class":390,"line":566},[388,780,484],{"class":401},[388,782,783],{"class":506}," const",[388,785,409],{"class":408},[388,787,788],{"class":412}," withEvlog",[388,790,593],{"class":408},[388,792,793],{"class":412}," useLogger",[388,795,593],{"class":408},[388,797,798],{"class":412}," log",[388,800,593],{"class":408},[388,802,803],{"class":412}," createError ",[388,805,642],{"class":408},[388,807,522],{"class":408},[388,809,683],{"class":490},[388,811,494],{"class":412},[388,813,814],{"class":408},"{\n",[388,816,817,820,823,825,828,830],{"class":390,"line":601},[388,818,819],{"class":537},"  service",[388,821,822],{"class":408},":",[388,824,422],{"class":408},[388,826,827],{"class":425},"my-app",[388,829,585],{"class":408},[388,831,832],{"class":408},",\n",[388,834,835,838],{"class":390,"line":639},[388,836,837],{"class":412},"  drain",[388,839,832],{"class":408},[388,841,843,845],{"class":390,"line":842},13,[388,844,642],{"class":408},[388,846,598],{"class":412},[388,848,850],{"class":390,"line":849},14,[388,851,478],{"emptyLinePlaceholder":477},[388,853,855],{"class":390,"line":854},15,[388,856,857],{"class":394},"\u002F\u002F Flush before shutdown (e.g. from your custom server or a teardown hook)\n",[388,859,861,863,865,868,870,872,874,876,878,880],{"class":390,"line":860},16,[388,862,484],{"class":401},[388,864,783],{"class":506},[388,866,867],{"class":412}," flushEvlog ",[388,869,745],{"class":408},[388,871,625],{"class":408},[388,873,507],{"class":506},[388,875,546],{"class":412},[388,877,572],{"class":408},[388,879,634],{"class":490},[388,881,538],{"class":412},[377,883,886],{"className":379,"code":884,"filename":885,"language":382,"meta":383,"style":383},"\u002F\u002F Same pattern — pass `drain` to the framework's evlog middleware\u002Fmodule\nimport type { DrainContext } from 'evlog'\nimport { createDrainPipeline } from 'evlog\u002Fpipeline'\nimport { createAxiomDrain } from 'evlog\u002Faxiom'\n\nconst pipeline = createDrainPipeline\u003CDrainContext>()\nconst drain = pipeline(createAxiomDrain())\n\napp.use(evlog({ drain })) \u002F\u002F Hono \u002F Express \u002F Elysia\n\u002F\u002F await app.register(evlog, { drain }) \u002F\u002F Fastify\n\u002F\u002F EvlogModule.forRoot({ drain }) \u002F\u002F NestJS\n\n\u002F\u002F Flush on shutdown\nprocess.on('SIGTERM', () => drain.flush())\n","Hono \u002F Express \u002F Fastify \u002F Elysia \u002F NestJS",[385,887,888,893,913,931,949,953,971,987,991,1020,1028,1036,1040,1045],{"__ignoreMap":383},[388,889,890],{"class":390,"line":391},[388,891,892],{"class":394},"\u002F\u002F Same pattern — pass `drain` to the framework's evlog middleware\u002Fmodule\n",[388,894,895,897,899,901,903,905,907,909,911],{"class":390,"line":398},[388,896,402],{"class":401},[388,898,405],{"class":401},[388,900,409],{"class":408},[388,902,413],{"class":412},[388,904,416],{"class":408},[388,906,419],{"class":401},[388,908,422],{"class":408},[388,910,426],{"class":425},[388,912,429],{"class":408},[388,914,915,917,919,921,923,925,927,929],{"class":390,"line":432},[388,916,402],{"class":401},[388,918,409],{"class":408},[388,920,439],{"class":412},[388,922,416],{"class":408},[388,924,419],{"class":401},[388,926,422],{"class":408},[388,928,448],{"class":425},[388,930,429],{"class":408},[388,932,933,935,937,939,941,943,945,947],{"class":390,"line":453},[388,934,402],{"class":401},[388,936,409],{"class":408},[388,938,460],{"class":412},[388,940,416],{"class":408},[388,942,419],{"class":401},[388,944,422],{"class":408},[388,946,469],{"class":425},[388,948,429],{"class":408},[388,950,951],{"class":390,"line":474},[388,952,478],{"emptyLinePlaceholder":477},[388,954,955,957,959,961,963,965,967,969],{"class":390,"line":481},[388,956,739],{"class":506},[388,958,742],{"class":412},[388,960,745],{"class":408},[388,962,439],{"class":490},[388,964,527],{"class":408},[388,966,531],{"class":530},[388,968,534],{"class":408},[388,970,538],{"class":412},[388,972,973,975,977,979,981,983,985],{"class":390,"line":513},[388,974,739],{"class":506},[388,976,762],{"class":412},[388,978,745],{"class":408},[388,980,519],{"class":490},[388,982,494],{"class":412},[388,984,555],{"class":490},[388,986,558],{"class":412},[388,988,989],{"class":390,"line":541},[388,990,478],{"emptyLinePlaceholder":477},[388,992,993,996,998,1001,1003,1005,1007,1010,1012,1014,1017],{"class":390,"line":561},[388,994,995],{"class":412},"app",[388,997,572],{"class":408},[388,999,1000],{"class":490},"use",[388,1002,494],{"class":412},[388,1004,426],{"class":490},[388,1006,494],{"class":412},[388,1008,1009],{"class":408},"{",[388,1011,762],{"class":412},[388,1013,642],{"class":408},[388,1015,1016],{"class":412},")) ",[388,1018,1019],{"class":394},"\u002F\u002F Hono \u002F Express \u002F Elysia\n",[388,1021,1022,1025],{"class":390,"line":566},[388,1023,1024],{"class":394},"\u002F\u002F await app.register(evlog, { drain })",[388,1026,1027],{"class":394}," \u002F\u002F Fastify\n",[388,1029,1030,1033],{"class":390,"line":601},[388,1031,1032],{"class":394},"\u002F\u002F EvlogModule.forRoot({ drain })",[388,1034,1035],{"class":394}," \u002F\u002F NestJS\n",[388,1037,1038],{"class":390,"line":639},[388,1039,478],{"emptyLinePlaceholder":477},[388,1041,1042],{"class":390,"line":842},[388,1043,1044],{"class":394},"\u002F\u002F Flush on shutdown\n",[388,1046,1047,1050,1052,1055,1057,1059,1062,1064,1066,1068,1070,1072,1074,1076],{"class":390,"line":849},[388,1048,1049],{"class":412},"process",[388,1051,572],{"class":408},[388,1053,1054],{"class":490},"on",[388,1056,494],{"class":412},[388,1058,585],{"class":408},[388,1060,1061],{"class":425},"SIGTERM",[388,1063,585],{"class":408},[388,1065,593],{"class":408},[388,1067,625],{"class":408},[388,1069,507],{"class":506},[388,1071,546],{"class":412},[388,1073,572],{"class":408},[388,1075,634],{"class":490},[388,1077,558],{"class":412},[377,1079,1081],{"className":379,"code":1080,"filename":194,"language":382,"meta":383,"style":383},"\u002F\u002F index.ts — plain TypeScript \u002F Bun \u002F Node script\nimport type { DrainContext } from 'evlog'\nimport { initLogger } from 'evlog'\nimport { createDrainPipeline } from 'evlog\u002Fpipeline'\nimport { createAxiomDrain } from 'evlog\u002Faxiom'\n\nconst pipeline = createDrainPipeline\u003CDrainContext>()\nconst drain = pipeline(createAxiomDrain())\n\ninitLogger({ drain })\n\n\u002F\u002F Flush before exit\nawait drain.flush()\n",[385,1082,1083,1088,1108,1127,1145,1163,1167,1185,1201,1205,1220,1224,1229],{"__ignoreMap":383},[388,1084,1085],{"class":390,"line":391},[388,1086,1087],{"class":394},"\u002F\u002F index.ts — plain TypeScript \u002F Bun \u002F Node script\n",[388,1089,1090,1092,1094,1096,1098,1100,1102,1104,1106],{"class":390,"line":398},[388,1091,402],{"class":401},[388,1093,405],{"class":401},[388,1095,409],{"class":408},[388,1097,413],{"class":412},[388,1099,416],{"class":408},[388,1101,419],{"class":401},[388,1103,422],{"class":408},[388,1105,426],{"class":425},[388,1107,429],{"class":408},[388,1109,1110,1112,1114,1117,1119,1121,1123,1125],{"class":390,"line":432},[388,1111,402],{"class":401},[388,1113,409],{"class":408},[388,1115,1116],{"class":412}," initLogger",[388,1118,416],{"class":408},[388,1120,419],{"class":401},[388,1122,422],{"class":408},[388,1124,426],{"class":425},[388,1126,429],{"class":408},[388,1128,1129,1131,1133,1135,1137,1139,1141,1143],{"class":390,"line":453},[388,1130,402],{"class":401},[388,1132,409],{"class":408},[388,1134,439],{"class":412},[388,1136,416],{"class":408},[388,1138,419],{"class":401},[388,1140,422],{"class":408},[388,1142,448],{"class":425},[388,1144,429],{"class":408},[388,1146,1147,1149,1151,1153,1155,1157,1159,1161],{"class":390,"line":474},[388,1148,402],{"class":401},[388,1150,409],{"class":408},[388,1152,460],{"class":412},[388,1154,416],{"class":408},[388,1156,419],{"class":401},[388,1158,422],{"class":408},[388,1160,469],{"class":425},[388,1162,429],{"class":408},[388,1164,1165],{"class":390,"line":481},[388,1166,478],{"emptyLinePlaceholder":477},[388,1168,1169,1171,1173,1175,1177,1179,1181,1183],{"class":390,"line":513},[388,1170,739],{"class":506},[388,1172,742],{"class":412},[388,1174,745],{"class":408},[388,1176,439],{"class":490},[388,1178,527],{"class":408},[388,1180,531],{"class":530},[388,1182,534],{"class":408},[388,1184,538],{"class":412},[388,1186,1187,1189,1191,1193,1195,1197,1199],{"class":390,"line":541},[388,1188,739],{"class":506},[388,1190,762],{"class":412},[388,1192,745],{"class":408},[388,1194,519],{"class":490},[388,1196,494],{"class":412},[388,1198,555],{"class":490},[388,1200,558],{"class":412},[388,1202,1203],{"class":390,"line":561},[388,1204,478],{"emptyLinePlaceholder":477},[388,1206,1207,1210,1212,1214,1216,1218],{"class":390,"line":566},[388,1208,1209],{"class":490},"initLogger",[388,1211,494],{"class":412},[388,1213,1009],{"class":408},[388,1215,762],{"class":412},[388,1217,642],{"class":408},[388,1219,598],{"class":412},[388,1221,1222],{"class":390,"line":601},[388,1223,478],{"emptyLinePlaceholder":477},[388,1225,1226],{"class":390,"line":639},[388,1227,1228],{"class":394},"\u002F\u002F Flush before exit\n",[388,1230,1231,1234,1236,1238,1240],{"class":390,"line":842},[388,1232,1233],{"class":401},"await",[388,1235,546],{"class":412},[388,1237,572],{"class":408},[388,1239,634],{"class":490},[388,1241,538],{"class":412},[1243,1244,1247,1248,1251,1252,1254,1255,1258,1259,572],"callout",{"color":1245,"icon":1246},"warning","i-lucide-alert-triangle","Always flush the pipeline before the process exits (",[385,1249,1250],{},"drain.flush()","). On Nitro use the ",[385,1253,618],{}," hook; on standalone scripts call it before ",[385,1256,1257],{},"process.exit","; on serverless runtimes use ",[385,1260,1261],{},"waitUntil(drain.flush())",[367,1263,1265],{"id":1264},"how-it-works","How It Works",[1267,1268,1269,1275,1287,1293,1300],"ol",{},[330,1270,1271,1272,1274],{},"Events are buffered in memory as they arrive via the ",[385,1273,588],{}," hook",[330,1276,1277,1278,1282,1283,1286],{},"A batch is flushed when either the ",[1279,1280,1281],"strong",{},"batch size"," is reached or the ",[1279,1284,1285],{},"interval"," expires (whichever comes first)",[330,1288,1289,1290],{},"If the drain function fails, the batch is retried with the configured ",[1279,1291,1292],{},"backoff strategy",[330,1294,1295,1296,1299],{},"If all retries are exhausted, ",[385,1297,1298],{},"onDropped"," is called with the lost events",[330,1301,1302,1303,1306],{},"If the buffer exceeds ",[385,1304,1305],{},"maxBufferSize",", the oldest events are dropped to prevent memory leaks",[367,1308,91],{"id":1309},"configuration",[315,1311,1312,1313,1316,1317,572],{},"The options below apply to any framework — wire the resulting ",[385,1314,1315],{},"drain"," the same way you did in ",[356,1318,20],{"href":1319},"#quick-start",[377,1321,1324],{"className":379,"code":1322,"filename":1323,"language":382,"meta":383,"style":383},"import type { DrainContext } from 'evlog'\nimport { createDrainPipeline } from 'evlog\u002Fpipeline'\nimport { createAxiomDrain } from 'evlog\u002Faxiom'\n\nconst pipeline = createDrainPipeline\u003CDrainContext>({\n  batch: {\n    size: 50,          \u002F\u002F Flush every 50 events\n    intervalMs: 5000,  \u002F\u002F Or every 5 seconds, whichever comes first\n  },\n  retry: {\n    maxAttempts: 3,\n    backoff: 'exponential',\n    initialDelayMs: 1000,\n    maxDelayMs: 30000,\n  },\n  maxBufferSize: 1000,\n  onDropped: (events, error) => {\n    console.error(`[evlog] Dropped ${events.length} events:`, error?.message)\n  },\n})\n\nexport const drain = pipeline(createAxiomDrain())\n\u002F\u002F Then wire `drain` to your framework — see Quick Start above.\n","pipeline-config.ts",[385,1325,1326,1346,1364,1382,1386,1406,1415,1431,1446,1451,1460,1472,1488,1500,1512,1516,1527,1552,1600,1605,1612,1617,1636],{"__ignoreMap":383},[388,1327,1328,1330,1332,1334,1336,1338,1340,1342,1344],{"class":390,"line":391},[388,1329,402],{"class":401},[388,1331,405],{"class":401},[388,1333,409],{"class":408},[388,1335,413],{"class":412},[388,1337,416],{"class":408},[388,1339,419],{"class":401},[388,1341,422],{"class":408},[388,1343,426],{"class":425},[388,1345,429],{"class":408},[388,1347,1348,1350,1352,1354,1356,1358,1360,1362],{"class":390,"line":398},[388,1349,402],{"class":401},[388,1351,409],{"class":408},[388,1353,439],{"class":412},[388,1355,416],{"class":408},[388,1357,419],{"class":401},[388,1359,422],{"class":408},[388,1361,448],{"class":425},[388,1363,429],{"class":408},[388,1365,1366,1368,1370,1372,1374,1376,1378,1380],{"class":390,"line":432},[388,1367,402],{"class":401},[388,1369,409],{"class":408},[388,1371,460],{"class":412},[388,1373,416],{"class":408},[388,1375,419],{"class":401},[388,1377,422],{"class":408},[388,1379,469],{"class":425},[388,1381,429],{"class":408},[388,1383,1384],{"class":390,"line":453},[388,1385,478],{"emptyLinePlaceholder":477},[388,1387,1388,1390,1392,1394,1396,1398,1400,1402,1404],{"class":390,"line":474},[388,1389,739],{"class":506},[388,1391,742],{"class":412},[388,1393,745],{"class":408},[388,1395,439],{"class":490},[388,1397,527],{"class":408},[388,1399,531],{"class":530},[388,1401,534],{"class":408},[388,1403,494],{"class":412},[388,1405,814],{"class":408},[388,1407,1408,1411,1413],{"class":390,"line":481},[388,1409,1410],{"class":537},"  batch",[388,1412,822],{"class":408},[388,1414,510],{"class":408},[388,1416,1417,1420,1422,1426,1428],{"class":390,"line":513},[388,1418,1419],{"class":537},"    size",[388,1421,822],{"class":408},[388,1423,1425],{"class":1424},"sbssI"," 50",[388,1427,593],{"class":408},[388,1429,1430],{"class":394},"          \u002F\u002F Flush every 50 events\n",[388,1432,1433,1436,1438,1441,1443],{"class":390,"line":541},[388,1434,1435],{"class":537},"    intervalMs",[388,1437,822],{"class":408},[388,1439,1440],{"class":1424}," 5000",[388,1442,593],{"class":408},[388,1444,1445],{"class":394},"  \u002F\u002F Or every 5 seconds, whichever comes first\n",[388,1447,1448],{"class":390,"line":561},[388,1449,1450],{"class":408},"  },\n",[388,1452,1453,1456,1458],{"class":390,"line":566},[388,1454,1455],{"class":537},"  retry",[388,1457,822],{"class":408},[388,1459,510],{"class":408},[388,1461,1462,1465,1467,1470],{"class":390,"line":601},[388,1463,1464],{"class":537},"    maxAttempts",[388,1466,822],{"class":408},[388,1468,1469],{"class":1424}," 3",[388,1471,832],{"class":408},[388,1473,1474,1477,1479,1481,1484,1486],{"class":390,"line":639},[388,1475,1476],{"class":537},"    backoff",[388,1478,822],{"class":408},[388,1480,422],{"class":408},[388,1482,1483],{"class":425},"exponential",[388,1485,585],{"class":408},[388,1487,832],{"class":408},[388,1489,1490,1493,1495,1498],{"class":390,"line":842},[388,1491,1492],{"class":537},"    initialDelayMs",[388,1494,822],{"class":408},[388,1496,1497],{"class":1424}," 1000",[388,1499,832],{"class":408},[388,1501,1502,1505,1507,1510],{"class":390,"line":849},[388,1503,1504],{"class":537},"    maxDelayMs",[388,1506,822],{"class":408},[388,1508,1509],{"class":1424}," 30000",[388,1511,832],{"class":408},[388,1513,1514],{"class":390,"line":854},[388,1515,1450],{"class":408},[388,1517,1518,1521,1523,1525],{"class":390,"line":860},[388,1519,1520],{"class":537},"  maxBufferSize",[388,1522,822],{"class":408},[388,1524,1497],{"class":1424},[388,1526,832],{"class":408},[388,1528,1530,1533,1535,1538,1541,1543,1546,1548,1550],{"class":390,"line":1529},17,[388,1531,1532],{"class":490},"  onDropped",[388,1534,822],{"class":408},[388,1536,1537],{"class":408}," (",[388,1539,1540],{"class":499},"events",[388,1542,593],{"class":408},[388,1544,1545],{"class":499}," error",[388,1547,503],{"class":408},[388,1549,507],{"class":506},[388,1551,510],{"class":408},[388,1553,1555,1558,1560,1563,1565,1568,1571,1574,1576,1578,1581,1583,1586,1588,1590,1592,1595,1598],{"class":390,"line":1554},18,[388,1556,1557],{"class":412},"    console",[388,1559,572],{"class":408},[388,1561,1562],{"class":490},"error",[388,1564,494],{"class":537},[388,1566,1567],{"class":408},"`",[388,1569,1570],{"class":425},"[evlog] Dropped ",[388,1572,1573],{"class":408},"${",[388,1575,1540],{"class":412},[388,1577,572],{"class":408},[388,1579,1580],{"class":412},"length",[388,1582,642],{"class":408},[388,1584,1585],{"class":425}," events:",[388,1587,1567],{"class":408},[388,1589,593],{"class":408},[388,1591,1545],{"class":412},[388,1593,1594],{"class":408},"?.",[388,1596,1597],{"class":412},"message",[388,1599,598],{"class":537},[388,1601,1603],{"class":390,"line":1602},19,[388,1604,1450],{"class":408},[388,1606,1608,1610],{"class":390,"line":1607},20,[388,1609,642],{"class":408},[388,1611,598],{"class":412},[388,1613,1615],{"class":390,"line":1614},21,[388,1616,478],{"emptyLinePlaceholder":477},[388,1618,1620,1622,1624,1626,1628,1630,1632,1634],{"class":390,"line":1619},22,[388,1621,484],{"class":401},[388,1623,783],{"class":506},[388,1625,762],{"class":412},[388,1627,745],{"class":408},[388,1629,519],{"class":490},[388,1631,494],{"class":412},[388,1633,555],{"class":490},[388,1635,558],{"class":412},[388,1637,1639],{"class":390,"line":1638},23,[388,1640,1641],{"class":394},"\u002F\u002F Then wire `drain` to your framework — see Quick Start above.\n",[1643,1644,1646],"h3",{"id":1645},"options-reference","Options Reference",[1648,1649,1650,1666],"table",{},[1651,1652,1653],"thead",{},[1654,1655,1656,1660,1663],"tr",{},[1657,1658,1659],"th",{},"Option",[1657,1661,1662],{},"Default",[1657,1664,1665],{},"Description",[1667,1668,1669,1685,1700,1715,1738,1753,1768,1781],"tbody",{},[1654,1670,1671,1677,1682],{},[1672,1673,1674],"td",{},[385,1675,1676],{},"batch.size",[1672,1678,1679],{},[385,1680,1681],{},"50",[1672,1683,1684],{},"Maximum events per batch",[1654,1686,1687,1692,1697],{},[1672,1688,1689],{},[385,1690,1691],{},"batch.intervalMs",[1672,1693,1694],{},[385,1695,1696],{},"5000",[1672,1698,1699],{},"Max time (ms) before flushing a partial batch",[1654,1701,1702,1707,1712],{},[1672,1703,1704],{},[385,1705,1706],{},"retry.maxAttempts",[1672,1708,1709],{},[385,1710,1711],{},"3",[1672,1713,1714],{},"Total attempts including the initial one",[1654,1716,1717,1722,1727],{},[1672,1718,1719],{},[385,1720,1721],{},"retry.backoff",[1672,1723,1724],{},[385,1725,1726],{},"'exponential'",[1672,1728,1729,1731,1732,1731,1735],{},[385,1730,1726],{}," | ",[385,1733,1734],{},"'linear'",[385,1736,1737],{},"'fixed'",[1654,1739,1740,1745,1750],{},[1672,1741,1742],{},[385,1743,1744],{},"retry.initialDelayMs",[1672,1746,1747],{},[385,1748,1749],{},"1000",[1672,1751,1752],{},"Base delay for the first retry",[1654,1754,1755,1760,1765],{},[1672,1756,1757],{},[385,1758,1759],{},"retry.maxDelayMs",[1672,1761,1762],{},[385,1763,1764],{},"30000",[1672,1766,1767],{},"Upper bound for any retry delay",[1654,1769,1770,1774,1778],{},[1672,1771,1772],{},[385,1773,1305],{},[1672,1775,1776],{},[385,1777,1749],{},[1672,1779,1780],{},"Max buffered events before dropping oldest",[1654,1782,1783,1787,1790],{},[1672,1784,1785],{},[385,1786,1298],{},[1672,1788,1789],{},"-",[1672,1791,1792],{},"Callback when events are dropped (overflow or retry exhaustion)",[367,1794,1796],{"id":1795},"backoff-strategies","Backoff Strategies",[1648,1798,1799,1812],{},[1651,1800,1801],{},[1654,1802,1803,1806,1809],{},[1657,1804,1805],{},"Strategy",[1657,1807,1808],{},"Delay Pattern",[1657,1810,1811],{},"Use Case",[1667,1813,1814,1826,1839],{},[1654,1815,1816,1820,1823],{},[1672,1817,1818],{},[385,1819,1483],{},[1672,1821,1822],{},"1s, 2s, 4s, 8s...",[1672,1824,1825],{},"Default. Best for transient failures that may need time to recover",[1654,1827,1828,1833,1836],{},[1672,1829,1830],{},[385,1831,1832],{},"linear",[1672,1834,1835],{},"1s, 2s, 3s, 4s...",[1672,1837,1838],{},"Predictable delay growth",[1654,1840,1841,1846,1849],{},[1672,1842,1843],{},[385,1844,1845],{},"fixed",[1672,1847,1848],{},"1s, 1s, 1s, 1s...",[1672,1850,1851],{},"Same delay every time. Useful for rate-limited APIs",[367,1853,1855],{"id":1854},"returned-drain-function","Returned Drain Function",[315,1857,1858,1859,1862],{},"The function returned by ",[385,1860,1861],{},"pipeline(drain)"," is hook-compatible and exposes:",[1648,1864,1865,1877],{},[1651,1866,1867],{},[1654,1868,1869,1872,1875],{},[1657,1870,1871],{},"Property",[1657,1873,1874],{},"Type",[1657,1876,1665],{},[1667,1878,1879,1894,1908],{},[1654,1880,1881,1886,1891],{},[1672,1882,1883],{},[385,1884,1885],{},"drain(ctx)",[1672,1887,1888],{},[385,1889,1890],{},"(ctx: T) => void",[1672,1892,1893],{},"Push a single event into the buffer",[1654,1895,1896,1900,1905],{},[1672,1897,1898],{},[385,1899,1250],{},[1672,1901,1902],{},[385,1903,1904],{},"() => Promise\u003Cvoid>",[1672,1906,1907],{},"Force-flush all buffered events",[1654,1909,1910,1915,1920],{},[1672,1911,1912],{},[385,1913,1914],{},"drain.pending",[1672,1916,1917],{},[385,1918,1919],{},"number",[1672,1921,1922],{},"Number of events currently buffered",[367,1924,1926],{"id":1925},"multiple-destinations","Multiple Destinations",[315,1928,1929],{},"Wrap multiple adapters with a single pipeline (one batch flushed in parallel to every destination):",[377,1931,1934],{"className":379,"code":1932,"filename":1933,"language":382,"meta":383,"style":383},"import type { DrainContext } from 'evlog'\nimport { createDrainPipeline } from 'evlog\u002Fpipeline'\nimport { createAxiomDrain } from 'evlog\u002Faxiom'\nimport { createOTLPDrain } from 'evlog\u002Fotlp'\n\nconst axiom = createAxiomDrain()\nconst otlp = createOTLPDrain()\n\nconst pipeline = createDrainPipeline\u003CDrainContext>()\nexport const drain = pipeline(async (batch) => {\n  await Promise.allSettled([axiom(batch), otlp(batch)])\n})\n\u002F\u002F Wire `drain` exactly like in Quick Start — Nitro hook, framework middleware, or initLogger.\n","pipeline-fan-out.ts",[385,1935,1936,1956,1974,1992,2012,2016,2029,2042,2046,2064,2092,2129,2135],{"__ignoreMap":383},[388,1937,1938,1940,1942,1944,1946,1948,1950,1952,1954],{"class":390,"line":391},[388,1939,402],{"class":401},[388,1941,405],{"class":401},[388,1943,409],{"class":408},[388,1945,413],{"class":412},[388,1947,416],{"class":408},[388,1949,419],{"class":401},[388,1951,422],{"class":408},[388,1953,426],{"class":425},[388,1955,429],{"class":408},[388,1957,1958,1960,1962,1964,1966,1968,1970,1972],{"class":390,"line":398},[388,1959,402],{"class":401},[388,1961,409],{"class":408},[388,1963,439],{"class":412},[388,1965,416],{"class":408},[388,1967,419],{"class":401},[388,1969,422],{"class":408},[388,1971,448],{"class":425},[388,1973,429],{"class":408},[388,1975,1976,1978,1980,1982,1984,1986,1988,1990],{"class":390,"line":432},[388,1977,402],{"class":401},[388,1979,409],{"class":408},[388,1981,460],{"class":412},[388,1983,416],{"class":408},[388,1985,419],{"class":401},[388,1987,422],{"class":408},[388,1989,469],{"class":425},[388,1991,429],{"class":408},[388,1993,1994,1996,1998,2001,2003,2005,2007,2010],{"class":390,"line":453},[388,1995,402],{"class":401},[388,1997,409],{"class":408},[388,1999,2000],{"class":412}," createOTLPDrain",[388,2002,416],{"class":408},[388,2004,419],{"class":401},[388,2006,422],{"class":408},[388,2008,2009],{"class":425},"evlog\u002Fotlp",[388,2011,429],{"class":408},[388,2013,2014],{"class":390,"line":474},[388,2015,478],{"emptyLinePlaceholder":477},[388,2017,2018,2020,2023,2025,2027],{"class":390,"line":481},[388,2019,739],{"class":506},[388,2021,2022],{"class":412}," axiom ",[388,2024,745],{"class":408},[388,2026,460],{"class":490},[388,2028,538],{"class":412},[388,2030,2031,2033,2036,2038,2040],{"class":390,"line":513},[388,2032,739],{"class":506},[388,2034,2035],{"class":412}," otlp ",[388,2037,745],{"class":408},[388,2039,2000],{"class":490},[388,2041,538],{"class":412},[388,2043,2044],{"class":390,"line":541},[388,2045,478],{"emptyLinePlaceholder":477},[388,2047,2048,2050,2052,2054,2056,2058,2060,2062],{"class":390,"line":561},[388,2049,739],{"class":506},[388,2051,742],{"class":412},[388,2053,745],{"class":408},[388,2055,439],{"class":490},[388,2057,527],{"class":408},[388,2059,531],{"class":530},[388,2061,534],{"class":408},[388,2063,538],{"class":412},[388,2065,2066,2068,2070,2072,2074,2076,2078,2081,2083,2086,2088,2090],{"class":390,"line":566},[388,2067,484],{"class":401},[388,2069,783],{"class":506},[388,2071,762],{"class":412},[388,2073,745],{"class":408},[388,2075,519],{"class":490},[388,2077,494],{"class":412},[388,2079,2080],{"class":506},"async",[388,2082,1537],{"class":408},[388,2084,2085],{"class":499},"batch",[388,2087,503],{"class":408},[388,2089,507],{"class":506},[388,2091,510],{"class":408},[388,2093,2094,2097,2100,2102,2105,2108,2111,2113,2115,2117,2119,2122,2124,2126],{"class":390,"line":601},[388,2095,2096],{"class":401},"  await",[388,2098,2099],{"class":530}," Promise",[388,2101,572],{"class":408},[388,2103,2104],{"class":490},"allSettled",[388,2106,2107],{"class":537},"([",[388,2109,2110],{"class":490},"axiom",[388,2112,494],{"class":537},[388,2114,2085],{"class":412},[388,2116,503],{"class":537},[388,2118,593],{"class":408},[388,2120,2121],{"class":490}," otlp",[388,2123,494],{"class":537},[388,2125,2085],{"class":412},[388,2127,2128],{"class":537},")])\n",[388,2130,2131,2133],{"class":390,"line":639},[388,2132,642],{"class":408},[388,2134,598],{"class":412},[388,2136,2137],{"class":390,"line":842},[388,2138,2139],{"class":394},"\u002F\u002F Wire `drain` exactly like in Quick Start — Nitro hook, framework middleware, or initLogger.\n",[367,2141,2143],{"id":2142},"custom-drain-function","Custom Drain Function",[315,2145,2146],{},"You don't need an adapter. Pass any async function that accepts a batch:",[377,2148,2151],{"className":379,"code":2149,"filename":2150,"language":382,"meta":383,"style":383},"import type { DrainContext } from 'evlog'\nimport { createDrainPipeline } from 'evlog\u002Fpipeline'\n\nconst pipeline = createDrainPipeline\u003CDrainContext>({ batch: { size: 100 } })\n\nexport const drain = pipeline(async (batch) => {\n  await fetch('https:\u002F\u002Fyour-service.com\u002Flogs', {\n    method: 'POST',\n    headers: { 'Content-Type': 'application\u002Fjson' },\n    body: JSON.stringify(batch.map(ctx => ctx.event)),\n  })\n})\n\u002F\u002F Wire `drain` to your framework — see Quick Start above.\n","pipeline-custom.ts",[385,2152,2153,2173,2191,2195,2236,2240,2266,2286,2302,2330,2374,2381,2387],{"__ignoreMap":383},[388,2154,2155,2157,2159,2161,2163,2165,2167,2169,2171],{"class":390,"line":391},[388,2156,402],{"class":401},[388,2158,405],{"class":401},[388,2160,409],{"class":408},[388,2162,413],{"class":412},[388,2164,416],{"class":408},[388,2166,419],{"class":401},[388,2168,422],{"class":408},[388,2170,426],{"class":425},[388,2172,429],{"class":408},[388,2174,2175,2177,2179,2181,2183,2185,2187,2189],{"class":390,"line":398},[388,2176,402],{"class":401},[388,2178,409],{"class":408},[388,2180,439],{"class":412},[388,2182,416],{"class":408},[388,2184,419],{"class":401},[388,2186,422],{"class":408},[388,2188,448],{"class":425},[388,2190,429],{"class":408},[388,2192,2193],{"class":390,"line":432},[388,2194,478],{"emptyLinePlaceholder":477},[388,2196,2197,2199,2201,2203,2205,2207,2209,2211,2213,2215,2218,2220,2222,2225,2227,2230,2232,2234],{"class":390,"line":453},[388,2198,739],{"class":506},[388,2200,742],{"class":412},[388,2202,745],{"class":408},[388,2204,439],{"class":490},[388,2206,527],{"class":408},[388,2208,531],{"class":530},[388,2210,534],{"class":408},[388,2212,494],{"class":412},[388,2214,1009],{"class":408},[388,2216,2217],{"class":537}," batch",[388,2219,822],{"class":408},[388,2221,409],{"class":408},[388,2223,2224],{"class":537}," size",[388,2226,822],{"class":408},[388,2228,2229],{"class":1424}," 100",[388,2231,416],{"class":408},[388,2233,416],{"class":408},[388,2235,598],{"class":412},[388,2237,2238],{"class":390,"line":474},[388,2239,478],{"emptyLinePlaceholder":477},[388,2241,2242,2244,2246,2248,2250,2252,2254,2256,2258,2260,2262,2264],{"class":390,"line":481},[388,2243,484],{"class":401},[388,2245,783],{"class":506},[388,2247,762],{"class":412},[388,2249,745],{"class":408},[388,2251,519],{"class":490},[388,2253,494],{"class":412},[388,2255,2080],{"class":506},[388,2257,1537],{"class":408},[388,2259,2085],{"class":499},[388,2261,503],{"class":408},[388,2263,507],{"class":506},[388,2265,510],{"class":408},[388,2267,2268,2270,2273,2275,2277,2280,2282,2284],{"class":390,"line":513},[388,2269,2096],{"class":401},[388,2271,2272],{"class":490}," fetch",[388,2274,494],{"class":537},[388,2276,585],{"class":408},[388,2278,2279],{"class":425},"https:\u002F\u002Fyour-service.com\u002Flogs",[388,2281,585],{"class":408},[388,2283,593],{"class":408},[388,2285,510],{"class":408},[388,2287,2288,2291,2293,2295,2298,2300],{"class":390,"line":541},[388,2289,2290],{"class":537},"    method",[388,2292,822],{"class":408},[388,2294,422],{"class":408},[388,2296,2297],{"class":425},"POST",[388,2299,585],{"class":408},[388,2301,832],{"class":408},[388,2303,2304,2307,2309,2311,2313,2316,2318,2320,2322,2325,2327],{"class":390,"line":561},[388,2305,2306],{"class":537},"    headers",[388,2308,822],{"class":408},[388,2310,409],{"class":408},[388,2312,422],{"class":408},[388,2314,2315],{"class":537},"Content-Type",[388,2317,585],{"class":408},[388,2319,822],{"class":408},[388,2321,422],{"class":408},[388,2323,2324],{"class":425},"application\u002Fjson",[388,2326,585],{"class":408},[388,2328,2329],{"class":408}," },\n",[388,2331,2332,2335,2337,2340,2342,2345,2347,2349,2351,2354,2356,2359,2361,2364,2366,2369,2372],{"class":390,"line":566},[388,2333,2334],{"class":537},"    body",[388,2336,822],{"class":408},[388,2338,2339],{"class":412}," JSON",[388,2341,572],{"class":408},[388,2343,2344],{"class":490},"stringify",[388,2346,494],{"class":537},[388,2348,2085],{"class":412},[388,2350,572],{"class":408},[388,2352,2353],{"class":490},"map",[388,2355,494],{"class":537},[388,2357,2358],{"class":499},"ctx",[388,2360,507],{"class":506},[388,2362,2363],{"class":412}," ctx",[388,2365,572],{"class":408},[388,2367,2368],{"class":412},"event",[388,2370,2371],{"class":537},"))",[388,2373,832],{"class":408},[388,2375,2376,2379],{"class":390,"line":601},[388,2377,2378],{"class":408},"  }",[388,2380,598],{"class":537},[388,2382,2383,2385],{"class":390,"line":639},[388,2384,642],{"class":408},[388,2386,598],{"class":412},[388,2388,2389],{"class":390,"line":842},[388,2390,2391],{"class":394},"\u002F\u002F Wire `drain` to your framework — see Quick Start above.\n",[1243,2393,2396,2397,2402,2403,2406],{"color":2394,"icon":2395},"neutral","i-lucide-arrow-right","See the full ",[356,2398,2401],{"href":2399,"rel":2400},"https:\u002F\u002Fgithub.com\u002Fhugorcd\u002Fevlog\u002Ftree\u002Fmain\u002Fexamples\u002Fbun-script",[360],"bun-script example"," for a complete working script using the standalone wiring, and the ",[356,2404,2405],{"href":140},"Next.js guide"," for an App Router implementation.",[367,2408,2410],{"id":2409},"next-steps","Next Steps",[327,2412,2413,2420,2425],{},[330,2414,2415,2419],{},[356,2416,2418],{"href":2417},"\u002Fadapters\u002Foverview","Adapters Overview"," - Available built-in adapters",[330,2421,2422,2424],{},[356,2423,288],{"href":289}," - Build your own drain function",[330,2426,2427,2429],{},[356,2428,106],{"href":107}," - Security and production tips",[2431,2432,2433],"style",{},"html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}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 .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}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 .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":383,"searchDepth":398,"depth":398,"links":2435},[2436,2437,2438,2441,2442,2443,2444,2445],{"id":369,"depth":398,"text":20},{"id":1264,"depth":398,"text":1265},{"id":1309,"depth":398,"text":91,"children":2439},[2440],{"id":1645,"depth":432,"text":1646},{"id":1795,"depth":398,"text":1796},{"id":1854,"depth":398,"text":1855},{"id":1925,"depth":398,"text":1926},{"id":2142,"depth":398,"text":2143},{"id":2409,"depth":398,"text":2410},"Batch events, retry on failure, and protect against buffer overflow with the shared drain pipeline. Supports fan-out to multiple adapters.","md",[2449,2452],{"label":2418,"icon":2450,"to":2417,"color":2394,"variant":2451},"i-custom-plug","subtle",{"label":288,"icon":291,"to":289,"color":2394,"variant":2451},{},{"title":278,"icon":281},{"title":310,"description":2446},"EYm-TLrD64WZ3s4aTkQxIVmB5a84Zl1aN1155oprN1s",[2458,2460],{"title":268,"path":269,"stem":270,"description":2459,"icon":271,"children":-1},"Self-hosted log retention for evlog using NuxtHub database storage. Store, query, and automatically clean up your structured logs with zero external dependencies.",{"title":283,"path":284,"stem":285,"description":2461,"icon":286,"children":-1},"Framework-agnostic HTTP log transport for sending client-side logs to your server via fetch or sendBeacon. Works in the browser or any environment with fetch. Use the `evlog\u002Fhttp` entry point.",1777667169699]