[{"data":1,"prerenderedAt":1794},["ShallowReactive",2],{"navigation_docs":3,"-adapters-overview":238,"-adapters-overview-surround":1789},[4,30,110,154,208,224],{"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},"Frameworks","\u002Fframeworks","2.frameworks",[35,40,45,50,55,60,65,70,75,80,85,90,95,100,105],{"title":36,"path":37,"stem":38,"icon":39},"Overview","\u002Fframeworks\u002Foverview","2.frameworks\u002F00.overview","i-lucide-layout-grid",{"title":41,"path":42,"stem":43,"icon":44},"Nuxt","\u002Fframeworks\u002Fnuxt","2.frameworks\u002F01.nuxt","i-simple-icons-nuxtdotjs",{"title":46,"path":47,"stem":48,"icon":49},"Next.js","\u002Fframeworks\u002Fnextjs","2.frameworks\u002F02.nextjs","i-simple-icons-nextdotjs",{"title":51,"path":52,"stem":53,"icon":54},"SvelteKit","\u002Fframeworks\u002Fsveltekit","2.frameworks\u002F03.sveltekit","i-simple-icons-svelte",{"title":56,"path":57,"stem":58,"icon":59},"Nitro","\u002Fframeworks\u002Fnitro","2.frameworks\u002F04.nitro","i-custom-nitro",{"title":61,"path":62,"stem":63,"icon":64},"TanStack Start","\u002Fframeworks\u002Ftanstack-start","2.frameworks\u002F05.tanstack-start","i-custom-tanstack",{"title":66,"path":67,"stem":68,"icon":69},"NestJS","\u002Fframeworks\u002Fnestjs","2.frameworks\u002F06.nestjs","i-simple-icons-nestjs",{"title":71,"path":72,"stem":73,"icon":74},"Express","\u002Fframeworks\u002Fexpress","2.frameworks\u002F07.express","i-simple-icons-express",{"title":76,"path":77,"stem":78,"icon":79},"Hono","\u002Fframeworks\u002Fhono","2.frameworks\u002F08.hono","i-simple-icons-hono",{"title":81,"path":82,"stem":83,"icon":84},"Fastify","\u002Fframeworks\u002Ffastify","2.frameworks\u002F09.fastify","i-simple-icons-fastify",{"title":86,"path":87,"stem":88,"icon":89},"Elysia","\u002Fframeworks\u002Felysia","2.frameworks\u002F10.elysia","i-custom-elysia",{"title":91,"path":92,"stem":93,"icon":94},"Cloudflare Workers","\u002Fframeworks\u002Fcloudflare-workers","2.frameworks\u002F11.cloudflare-workers","i-simple-icons-cloudflare",{"title":96,"path":97,"stem":98,"icon":99},"Standalone","\u002Fframeworks\u002Fstandalone","2.frameworks\u002F12.standalone","i-simple-icons-typescript",{"title":101,"path":102,"stem":103,"icon":104},"Astro","\u002Fframeworks\u002Fastro","2.frameworks\u002F13.astro","i-simple-icons-astro",{"title":106,"path":107,"stem":108,"icon":109},"Custom Integration","\u002Fframeworks\u002Fcustom-integration","2.frameworks\u002F14.custom-integration","i-lucide-puzzle",{"title":111,"path":112,"stem":113,"children":114,"page":29},"Core Concepts","\u002Fcore-concepts","3.core-concepts",[115,120,125,130,135,139,144,149],{"title":116,"path":117,"stem":118,"icon":119},"Request Lifecycle","\u002Fcore-concepts\u002Flifecycle","3.core-concepts\u002F0.lifecycle","i-lucide-arrow-right-left",{"title":121,"path":122,"stem":123,"icon":124},"Wide Events","\u002Fcore-concepts\u002Fwide-events","3.core-concepts\u002F1.wide-events","i-lucide-layers",{"title":126,"path":127,"stem":128,"icon":129},"Structured Errors","\u002Fcore-concepts\u002Fstructured-errors","3.core-concepts\u002F2.structured-errors","i-lucide-shield-alert",{"title":131,"path":132,"stem":133,"icon":134},"Best Practices","\u002Fcore-concepts\u002Fbest-practices","3.core-concepts\u002F3.best-practices","i-lucide-shield-check",{"title":136,"path":137,"stem":138,"icon":99},"Typed Fields","\u002Fcore-concepts\u002Ftyped-fields","3.core-concepts\u002F4.typed-fields",{"title":140,"path":141,"stem":142,"icon":143},"Sampling","\u002Fcore-concepts\u002Fsampling","3.core-concepts\u002F5.sampling","i-lucide-filter",{"title":145,"path":146,"stem":147,"icon":148},"Client Logging","\u002Fcore-concepts\u002Fclient-logging","3.core-concepts\u002F6.client-logging","i-lucide-monitor",{"title":150,"path":151,"stem":152,"icon":153},"Configuration","\u002Fcore-concepts\u002Fconfiguration","3.core-concepts\u002F7.configuration","i-lucide-settings",{"title":155,"path":156,"stem":157,"children":158,"page":29},"Adapters","\u002Fadapters","4.adapters",[159,163,168,173,178,183,188,193,198,203],{"title":36,"path":160,"stem":161,"icon":162},"\u002Fadapters\u002Foverview","4.adapters\u002F1.overview","i-custom-plug",{"title":164,"path":165,"stem":166,"icon":167},"Browser","\u002Fadapters\u002Fbrowser","4.adapters\u002F10.browser","i-lucide-globe",{"title":169,"path":170,"stem":171,"icon":172},"Axiom","\u002Fadapters\u002Faxiom","4.adapters\u002F2.axiom","i-custom-axiom",{"title":174,"path":175,"stem":176,"icon":177},"OTLP","\u002Fadapters\u002Fotlp","4.adapters\u002F3.otlp","i-simple-icons-opentelemetry",{"title":179,"path":180,"stem":181,"icon":182},"PostHog","\u002Fadapters\u002Fposthog","4.adapters\u002F4.posthog","i-simple-icons-posthog",{"title":184,"path":185,"stem":186,"icon":187},"Sentry","\u002Fadapters\u002Fsentry","4.adapters\u002F5.sentry","i-simple-icons-sentry",{"title":189,"path":190,"stem":191,"icon":192},"Better Stack","\u002Fadapters\u002Fbetter-stack","4.adapters\u002F6.better-stack","i-simple-icons-betterstack",{"title":194,"path":195,"stem":196,"icon":197},"File System","\u002Fadapters\u002Ffs","4.adapters\u002F7.fs","i-lucide-hard-drive",{"title":199,"path":200,"stem":201,"icon":202},"Custom Adapters","\u002Fadapters\u002Fcustom","4.adapters\u002F8.custom","i-lucide-code",{"title":204,"path":205,"stem":206,"icon":207},"Pipeline","\u002Fadapters\u002Fpipeline","4.adapters\u002F9.pipeline","i-lucide-workflow",{"title":209,"path":210,"stem":211,"children":212,"page":29},"Enrichers","\u002Fenrichers","5.enrichers",[213,216,220],{"title":36,"path":214,"stem":215,"icon":28},"\u002Fenrichers\u002Foverview","5.enrichers\u002F1.overview",{"title":217,"path":218,"stem":219,"icon":109},"Built-in","\u002Fenrichers\u002Fbuilt-in","5.enrichers\u002F2.built-in",{"title":221,"path":222,"stem":223,"icon":202},"Custom","\u002Fenrichers\u002Fcustom","5.enrichers\u002F3.custom",{"title":225,"path":226,"stem":227,"children":228,"page":29},"NuxtHub","\u002Fnuxthub","6.nuxthub",[229,233],{"title":36,"path":230,"stem":231,"icon":232},"\u002Fnuxthub\u002Foverview","6.nuxthub\u002F1.overview","i-lucide-database",{"title":234,"path":235,"stem":236,"icon":237},"Retention","\u002Fnuxthub\u002Fretention","6.nuxthub\u002F2.retention","i-lucide-clock",{"id":239,"title":240,"body":241,"description":1775,"extension":1776,"links":1777,"meta":1785,"navigation":1786,"path":160,"seo":1787,"stem":161,"__hash__":1788},"docs\u002F4.adapters\u002F1.overview.md","Adapters Overview",{"type":242,"value":243,"toc":1767},"minimark",[244,248,253,266,269,737,750,754,785,789,799,1150,1163,1167,1170,1312,1318,1529,1533,1539,1616,1633,1637,1640,1647,1756,1763],[245,246,247],"p",{},"Adapters let you send logs to external observability platforms. evlog provides built-in adapters for popular services, and you can create custom adapters for any destination.",[249,250,252],"h2",{"id":251},"how-adapters-work","How Adapters Work",[245,254,255,256,260,261,265],{},"Adapters receive a ",[257,258,259],"code",{},"DrainContext"," after each request completes and send the data to an external service. The drain runs in ",[262,263,264],"strong",{},"fire-and-forget"," mode, meaning it never blocks the HTTP response.",[245,267,268],{},"How you wire an adapter depends on your framework:",[270,271,272,406,469,523,582,636,689],"code-group",{},[273,274,280],"pre",{"className":275,"code":276,"filename":277,"language":278,"meta":279,"style":279},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F server\u002Fplugins\u002Fevlog-drain.ts\nimport { createAxiomDrain } from 'evlog\u002Faxiom'\n\nexport default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('evlog:drain', createAxiomDrain())\n})\n","Nuxt \u002F Nitro","typescript","",[257,281,282,291,322,329,361,397],{"__ignoreMap":279},[283,284,287],"span",{"class":285,"line":286},"line",1,[283,288,290],{"class":289},"sHwdD","\u002F\u002F server\u002Fplugins\u002Fevlog-drain.ts\n",[283,292,294,298,302,306,309,312,315,319],{"class":285,"line":293},2,[283,295,297],{"class":296},"s7zQu","import",[283,299,301],{"class":300},"sMK4o"," {",[283,303,305],{"class":304},"sTEyZ"," createAxiomDrain",[283,307,308],{"class":300}," }",[283,310,311],{"class":296}," from",[283,313,314],{"class":300}," '",[283,316,318],{"class":317},"sfazB","evlog\u002Faxiom",[283,320,321],{"class":300},"'\n",[283,323,325],{"class":285,"line":324},3,[283,326,328],{"emptyLinePlaceholder":327},true,"\n",[283,330,332,335,338,342,345,347,351,354,358],{"class":285,"line":331},4,[283,333,334],{"class":296},"export",[283,336,337],{"class":296}," default",[283,339,341],{"class":340},"s2Zo4"," defineNitroPlugin",[283,343,344],{"class":304},"(",[283,346,344],{"class":300},[283,348,350],{"class":349},"sHdIc","nitroApp",[283,352,353],{"class":300},")",[283,355,357],{"class":356},"spNyl"," =>",[283,359,360],{"class":300}," {\n",[283,362,364,367,370,373,375,378,381,384,387,389,392,394],{"class":285,"line":363},5,[283,365,366],{"class":304},"  nitroApp",[283,368,369],{"class":300},".",[283,371,372],{"class":304},"hooks",[283,374,369],{"class":300},[283,376,377],{"class":340},"hook",[283,379,344],{"class":380},"swJcz",[283,382,383],{"class":300},"'",[283,385,386],{"class":317},"evlog:drain",[283,388,383],{"class":300},[283,390,391],{"class":300},",",[283,393,305],{"class":340},[283,395,396],{"class":380},"())\n",[283,398,400,403],{"class":285,"line":399},6,[283,401,402],{"class":300},"}",[283,404,405],{"class":304},")\n",[273,407,409],{"className":275,"code":408,"filename":76,"language":278,"meta":279,"style":279},"import { createAxiomDrain } from 'evlog\u002Faxiom'\n\napp.use(evlog({ drain: createAxiomDrain() }))\n",[257,410,411,429,433],{"__ignoreMap":279},[283,412,413,415,417,419,421,423,425,427],{"class":285,"line":286},[283,414,297],{"class":296},[283,416,301],{"class":300},[283,418,305],{"class":304},[283,420,308],{"class":300},[283,422,311],{"class":296},[283,424,314],{"class":300},[283,426,318],{"class":317},[283,428,321],{"class":300},[283,430,431],{"class":285,"line":293},[283,432,328],{"emptyLinePlaceholder":327},[283,434,435,438,440,443,445,448,450,453,456,459,461,464,466],{"class":285,"line":324},[283,436,437],{"class":304},"app",[283,439,369],{"class":300},[283,441,442],{"class":340},"use",[283,444,344],{"class":304},[283,446,447],{"class":340},"evlog",[283,449,344],{"class":304},[283,451,452],{"class":300},"{",[283,454,455],{"class":380}," drain",[283,457,458],{"class":300},":",[283,460,305],{"class":340},[283,462,463],{"class":304},"() ",[283,465,402],{"class":300},[283,467,468],{"class":304},"))\n",[273,470,471],{"className":275,"code":408,"filename":71,"language":278,"meta":279,"style":279},[257,472,473,491,495],{"__ignoreMap":279},[283,474,475,477,479,481,483,485,487,489],{"class":285,"line":286},[283,476,297],{"class":296},[283,478,301],{"class":300},[283,480,305],{"class":304},[283,482,308],{"class":300},[283,484,311],{"class":296},[283,486,314],{"class":300},[283,488,318],{"class":317},[283,490,321],{"class":300},[283,492,493],{"class":285,"line":293},[283,494,328],{"emptyLinePlaceholder":327},[283,496,497,499,501,503,505,507,509,511,513,515,517,519,521],{"class":285,"line":324},[283,498,437],{"class":304},[283,500,369],{"class":300},[283,502,442],{"class":340},[283,504,344],{"class":304},[283,506,447],{"class":340},[283,508,344],{"class":304},[283,510,452],{"class":300},[283,512,455],{"class":380},[283,514,458],{"class":300},[283,516,305],{"class":340},[283,518,463],{"class":304},[283,520,402],{"class":300},[283,522,468],{"class":304},[273,524,526],{"className":275,"code":525,"filename":81,"language":278,"meta":279,"style":279},"import { createAxiomDrain } from 'evlog\u002Faxiom'\n\nawait app.register(evlog, { drain: createAxiomDrain() })\n",[257,527,528,546,550],{"__ignoreMap":279},[283,529,530,532,534,536,538,540,542,544],{"class":285,"line":286},[283,531,297],{"class":296},[283,533,301],{"class":300},[283,535,305],{"class":304},[283,537,308],{"class":300},[283,539,311],{"class":296},[283,541,314],{"class":300},[283,543,318],{"class":317},[283,545,321],{"class":300},[283,547,548],{"class":285,"line":293},[283,549,328],{"emptyLinePlaceholder":327},[283,551,552,555,558,560,563,566,568,570,572,574,576,578,580],{"class":285,"line":324},[283,553,554],{"class":296},"await",[283,556,557],{"class":304}," app",[283,559,369],{"class":300},[283,561,562],{"class":340},"register",[283,564,565],{"class":304},"(evlog",[283,567,391],{"class":300},[283,569,301],{"class":300},[283,571,455],{"class":380},[283,573,458],{"class":300},[283,575,305],{"class":340},[283,577,463],{"class":304},[283,579,402],{"class":300},[283,581,405],{"class":304},[273,583,584],{"className":275,"code":408,"filename":86,"language":278,"meta":279,"style":279},[257,585,586,604,608],{"__ignoreMap":279},[283,587,588,590,592,594,596,598,600,602],{"class":285,"line":286},[283,589,297],{"class":296},[283,591,301],{"class":300},[283,593,305],{"class":304},[283,595,308],{"class":300},[283,597,311],{"class":296},[283,599,314],{"class":300},[283,601,318],{"class":317},[283,603,321],{"class":300},[283,605,606],{"class":285,"line":293},[283,607,328],{"emptyLinePlaceholder":327},[283,609,610,612,614,616,618,620,622,624,626,628,630,632,634],{"class":285,"line":324},[283,611,437],{"class":304},[283,613,369],{"class":300},[283,615,442],{"class":340},[283,617,344],{"class":304},[283,619,447],{"class":340},[283,621,344],{"class":304},[283,623,452],{"class":300},[283,625,455],{"class":380},[283,627,458],{"class":300},[283,629,305],{"class":340},[283,631,463],{"class":304},[283,633,402],{"class":300},[283,635,468],{"class":304},[273,637,639],{"className":275,"code":638,"filename":66,"language":278,"meta":279,"style":279},"import { createAxiomDrain } from 'evlog\u002Faxiom'\n\nEvlogModule.forRoot({ drain: createAxiomDrain() })\n",[257,640,641,659,663],{"__ignoreMap":279},[283,642,643,645,647,649,651,653,655,657],{"class":285,"line":286},[283,644,297],{"class":296},[283,646,301],{"class":300},[283,648,305],{"class":304},[283,650,308],{"class":300},[283,652,311],{"class":296},[283,654,314],{"class":300},[283,656,318],{"class":317},[283,658,321],{"class":300},[283,660,661],{"class":285,"line":293},[283,662,328],{"emptyLinePlaceholder":327},[283,664,665,668,670,673,675,677,679,681,683,685,687],{"class":285,"line":324},[283,666,667],{"class":304},"EvlogModule",[283,669,369],{"class":300},[283,671,672],{"class":340},"forRoot",[283,674,344],{"class":304},[283,676,452],{"class":300},[283,678,455],{"class":380},[283,680,458],{"class":300},[283,682,305],{"class":340},[283,684,463],{"class":304},[283,686,402],{"class":300},[283,688,405],{"class":304},[273,690,692],{"className":275,"code":691,"filename":96,"language":278,"meta":279,"style":279},"import { createAxiomDrain } from 'evlog\u002Faxiom'\n\ninitLogger({ drain: createAxiomDrain() })\n",[257,693,694,712,716],{"__ignoreMap":279},[283,695,696,698,700,702,704,706,708,710],{"class":285,"line":286},[283,697,297],{"class":296},[283,699,301],{"class":300},[283,701,305],{"class":304},[283,703,308],{"class":300},[283,705,311],{"class":296},[283,707,314],{"class":300},[283,709,318],{"class":317},[283,711,321],{"class":300},[283,713,714],{"class":285,"line":293},[283,715,328],{"emptyLinePlaceholder":327},[283,717,718,721,723,725,727,729,731,733,735],{"class":285,"line":324},[283,719,720],{"class":340},"initLogger",[283,722,344],{"class":304},[283,724,452],{"class":300},[283,726,455],{"class":380},[283,728,458],{"class":300},[283,730,305],{"class":340},[283,732,463],{"class":304},[283,734,402],{"class":300},[283,736,405],{"class":304},[738,739,742,745,746,749],"callout",{"color":740,"icon":741},"info","i-lucide-cloud",[262,743,744],{},"Serverless Support:"," On Cloudflare Workers and Vercel Edge, evlog automatically uses ",[257,747,748],{},"waitUntil()"," to ensure drains complete before the runtime terminates. No additional configuration needed.",[249,751,753],{"id":752},"available-adapters","Available Adapters",[755,756,757,761,764,767,770,773,776,779,782],"card-group",{},[758,759,760],"card",{"icon":172,"title":169,"to":170},"Send logs to Axiom for powerful querying and dashboards.",[758,762,763],{"icon":177,"title":174,"to":175},"OpenTelemetry Protocol for Grafana, Datadog, Honeycomb, and more.",[758,765,766],{"icon":182,"title":179,"to":180},"Send logs to PostHog Logs for structured logging and observability.",[758,768,769],{"icon":187,"title":184,"to":185},"Send structured logs to Sentry Logs for high-cardinality querying.",[758,771,772],{"icon":192,"title":189,"to":190},"Send logs to Better Stack for log management and alerting.",[758,774,775],{"icon":197,"title":194,"to":195},"Write logs to local NDJSON files for debugging and AI agent integration.",[758,777,778],{"icon":202,"title":221,"to":200},"Build your own adapter for any destination.",[758,780,781],{"icon":167,"title":164,"to":165},"Send browser logs to your server without framework coupling.",[758,783,784],{"icon":207,"title":204,"to":205},"Batch events, retry on failure, and handle buffer overflow.",[249,786,788],{"id":787},"standalone-usage","Standalone Usage",[245,790,791,792,795,796,798],{},"In plain TypeScript or Bun scripts (no HTTP framework), use the ",[257,793,794],{},"drain"," option in ",[257,797,720],{},". Every emitted event is drained automatically.",[273,800,803],{"className":275,"code":801,"filename":802,"language":278,"meta":279,"style":279},"import type { DrainContext } from 'evlog'\nimport { initLogger, log, createRequestLogger } from 'evlog'\nimport { createAxiomDrain } from 'evlog\u002Faxiom'\nimport { createDrainPipeline } from 'evlog\u002Fpipeline'\n\nconst pipeline = createDrainPipeline\u003CDrainContext>()\nconst drain = pipeline(createAxiomDrain())\n\ninitLogger({\n  env: { service: 'my-script' },\n  drain,\n})\n\nlog.info({ action: 'job_started' }) \u002F\u002F drained automatically\n\nconst reqLog = createRequestLogger({ method: 'POST', path: '\u002Fprocess' })\nreqLog.set({ processed: 42 })\nreqLog.emit() \u002F\u002F drained automatically\n\nawait drain.flush()\n","index.ts",[257,804,805,827,856,874,894,898,923,943,948,958,983,992,999,1004,1038,1043,1089,1117,1131,1136],{"__ignoreMap":279},[283,806,807,809,812,814,817,819,821,823,825],{"class":285,"line":286},[283,808,297],{"class":296},[283,810,811],{"class":296}," type",[283,813,301],{"class":300},[283,815,816],{"class":304}," DrainContext",[283,818,308],{"class":300},[283,820,311],{"class":296},[283,822,314],{"class":300},[283,824,447],{"class":317},[283,826,321],{"class":300},[283,828,829,831,833,836,838,841,843,846,848,850,852,854],{"class":285,"line":293},[283,830,297],{"class":296},[283,832,301],{"class":300},[283,834,835],{"class":304}," initLogger",[283,837,391],{"class":300},[283,839,840],{"class":304}," log",[283,842,391],{"class":300},[283,844,845],{"class":304}," createRequestLogger",[283,847,308],{"class":300},[283,849,311],{"class":296},[283,851,314],{"class":300},[283,853,447],{"class":317},[283,855,321],{"class":300},[283,857,858,860,862,864,866,868,870,872],{"class":285,"line":324},[283,859,297],{"class":296},[283,861,301],{"class":300},[283,863,305],{"class":304},[283,865,308],{"class":300},[283,867,311],{"class":296},[283,869,314],{"class":300},[283,871,318],{"class":317},[283,873,321],{"class":300},[283,875,876,878,880,883,885,887,889,892],{"class":285,"line":331},[283,877,297],{"class":296},[283,879,301],{"class":300},[283,881,882],{"class":304}," createDrainPipeline",[283,884,308],{"class":300},[283,886,311],{"class":296},[283,888,314],{"class":300},[283,890,891],{"class":317},"evlog\u002Fpipeline",[283,893,321],{"class":300},[283,895,896],{"class":285,"line":363},[283,897,328],{"emptyLinePlaceholder":327},[283,899,900,903,906,909,911,914,917,920],{"class":285,"line":399},[283,901,902],{"class":356},"const",[283,904,905],{"class":304}," pipeline ",[283,907,908],{"class":300},"=",[283,910,882],{"class":340},[283,912,913],{"class":300},"\u003C",[283,915,259],{"class":916},"sBMFI",[283,918,919],{"class":300},">",[283,921,922],{"class":304},"()\n",[283,924,926,928,931,933,936,938,941],{"class":285,"line":925},7,[283,927,902],{"class":356},[283,929,930],{"class":304}," drain ",[283,932,908],{"class":300},[283,934,935],{"class":340}," pipeline",[283,937,344],{"class":304},[283,939,940],{"class":340},"createAxiomDrain",[283,942,396],{"class":304},[283,944,946],{"class":285,"line":945},8,[283,947,328],{"emptyLinePlaceholder":327},[283,949,951,953,955],{"class":285,"line":950},9,[283,952,720],{"class":340},[283,954,344],{"class":304},[283,956,957],{"class":300},"{\n",[283,959,961,964,966,968,971,973,975,978,980],{"class":285,"line":960},10,[283,962,963],{"class":380},"  env",[283,965,458],{"class":300},[283,967,301],{"class":300},[283,969,970],{"class":380}," service",[283,972,458],{"class":300},[283,974,314],{"class":300},[283,976,977],{"class":317},"my-script",[283,979,383],{"class":300},[283,981,982],{"class":300}," },\n",[283,984,986,989],{"class":285,"line":985},11,[283,987,988],{"class":304},"  drain",[283,990,991],{"class":300},",\n",[283,993,995,997],{"class":285,"line":994},12,[283,996,402],{"class":300},[283,998,405],{"class":304},[283,1000,1002],{"class":285,"line":1001},13,[283,1003,328],{"emptyLinePlaceholder":327},[283,1005,1007,1010,1012,1014,1016,1018,1021,1023,1025,1028,1030,1032,1035],{"class":285,"line":1006},14,[283,1008,1009],{"class":304},"log",[283,1011,369],{"class":300},[283,1013,740],{"class":340},[283,1015,344],{"class":304},[283,1017,452],{"class":300},[283,1019,1020],{"class":380}," action",[283,1022,458],{"class":300},[283,1024,314],{"class":300},[283,1026,1027],{"class":317},"job_started",[283,1029,383],{"class":300},[283,1031,308],{"class":300},[283,1033,1034],{"class":304},") ",[283,1036,1037],{"class":289},"\u002F\u002F drained automatically\n",[283,1039,1041],{"class":285,"line":1040},15,[283,1042,328],{"emptyLinePlaceholder":327},[283,1044,1046,1048,1051,1053,1055,1057,1059,1062,1064,1066,1069,1071,1073,1076,1078,1080,1083,1085,1087],{"class":285,"line":1045},16,[283,1047,902],{"class":356},[283,1049,1050],{"class":304}," reqLog ",[283,1052,908],{"class":300},[283,1054,845],{"class":340},[283,1056,344],{"class":304},[283,1058,452],{"class":300},[283,1060,1061],{"class":380}," method",[283,1063,458],{"class":300},[283,1065,314],{"class":300},[283,1067,1068],{"class":317},"POST",[283,1070,383],{"class":300},[283,1072,391],{"class":300},[283,1074,1075],{"class":380}," path",[283,1077,458],{"class":300},[283,1079,314],{"class":300},[283,1081,1082],{"class":317},"\u002Fprocess",[283,1084,383],{"class":300},[283,1086,308],{"class":300},[283,1088,405],{"class":304},[283,1090,1092,1095,1097,1100,1102,1104,1107,1109,1113,1115],{"class":285,"line":1091},17,[283,1093,1094],{"class":304},"reqLog",[283,1096,369],{"class":300},[283,1098,1099],{"class":340},"set",[283,1101,344],{"class":304},[283,1103,452],{"class":300},[283,1105,1106],{"class":380}," processed",[283,1108,458],{"class":300},[283,1110,1112],{"class":1111},"sbssI"," 42",[283,1114,308],{"class":300},[283,1116,405],{"class":304},[283,1118,1120,1122,1124,1127,1129],{"class":285,"line":1119},18,[283,1121,1094],{"class":304},[283,1123,369],{"class":300},[283,1125,1126],{"class":340},"emit",[283,1128,463],{"class":304},[283,1130,1037],{"class":289},[283,1132,1134],{"class":285,"line":1133},19,[283,1135,328],{"emptyLinePlaceholder":327},[283,1137,1139,1141,1143,1145,1148],{"class":285,"line":1138},20,[283,1140,554],{"class":296},[283,1142,455],{"class":304},[283,1144,369],{"class":300},[283,1146,1147],{"class":340},"flush",[283,1149,922],{"class":304},[738,1151,1154,1155,1162],{"color":1152,"icon":1153},"neutral","i-lucide-arrow-right","See the full ",[1156,1157,1161],"a",{"href":1158,"rel":1159},"https:\u002F\u002Fgithub.com\u002FHugoRCD\u002Fevlog\u002Ftree\u002Fmain\u002Fexamples\u002Fbun-script",[1160],"nofollow","bun-script example"," for a realistic batch processing script.",[249,1164,1166],{"id":1165},"multiple-destinations","Multiple Destinations",[245,1168,1169],{},"Send logs to multiple services simultaneously by composing drains:",[273,1171,1173],{"className":275,"code":1172,"language":278,"meta":279,"style":279},"import { createAxiomDrain } from 'evlog\u002Faxiom'\nimport { createOTLPDrain } from 'evlog\u002Fotlp'\n\nconst axiom = createAxiomDrain()\nconst otlp = createOTLPDrain()\n\nconst drain = async (ctx) => {\n  await Promise.allSettled([axiom(ctx), otlp(ctx)])\n}\n",[257,1174,1175,1193,1213,1217,1230,1243,1247,1270,1307],{"__ignoreMap":279},[283,1176,1177,1179,1181,1183,1185,1187,1189,1191],{"class":285,"line":286},[283,1178,297],{"class":296},[283,1180,301],{"class":300},[283,1182,305],{"class":304},[283,1184,308],{"class":300},[283,1186,311],{"class":296},[283,1188,314],{"class":300},[283,1190,318],{"class":317},[283,1192,321],{"class":300},[283,1194,1195,1197,1199,1202,1204,1206,1208,1211],{"class":285,"line":293},[283,1196,297],{"class":296},[283,1198,301],{"class":300},[283,1200,1201],{"class":304}," createOTLPDrain",[283,1203,308],{"class":300},[283,1205,311],{"class":296},[283,1207,314],{"class":300},[283,1209,1210],{"class":317},"evlog\u002Fotlp",[283,1212,321],{"class":300},[283,1214,1215],{"class":285,"line":324},[283,1216,328],{"emptyLinePlaceholder":327},[283,1218,1219,1221,1224,1226,1228],{"class":285,"line":331},[283,1220,902],{"class":356},[283,1222,1223],{"class":304}," axiom ",[283,1225,908],{"class":300},[283,1227,305],{"class":340},[283,1229,922],{"class":304},[283,1231,1232,1234,1237,1239,1241],{"class":285,"line":363},[283,1233,902],{"class":356},[283,1235,1236],{"class":304}," otlp ",[283,1238,908],{"class":300},[283,1240,1201],{"class":340},[283,1242,922],{"class":304},[283,1244,1245],{"class":285,"line":399},[283,1246,328],{"emptyLinePlaceholder":327},[283,1248,1249,1251,1253,1255,1258,1261,1264,1266,1268],{"class":285,"line":925},[283,1250,902],{"class":356},[283,1252,930],{"class":304},[283,1254,908],{"class":300},[283,1256,1257],{"class":356}," async",[283,1259,1260],{"class":300}," (",[283,1262,1263],{"class":349},"ctx",[283,1265,353],{"class":300},[283,1267,357],{"class":356},[283,1269,360],{"class":300},[283,1271,1272,1275,1278,1280,1283,1286,1289,1291,1293,1295,1297,1300,1302,1304],{"class":285,"line":945},[283,1273,1274],{"class":296},"  await",[283,1276,1277],{"class":916}," Promise",[283,1279,369],{"class":300},[283,1281,1282],{"class":340},"allSettled",[283,1284,1285],{"class":380},"([",[283,1287,1288],{"class":340},"axiom",[283,1290,344],{"class":380},[283,1292,1263],{"class":304},[283,1294,353],{"class":380},[283,1296,391],{"class":300},[283,1298,1299],{"class":340}," otlp",[283,1301,344],{"class":380},[283,1303,1263],{"class":304},[283,1305,1306],{"class":380},")])\n",[283,1308,1309],{"class":285,"line":950},[283,1310,1311],{"class":300},"}\n",[245,1313,1314,1315,1317],{},"Then pass ",[257,1316,794],{}," to your framework:",[270,1319,1320,1381,1408,1434,1461,1487,1510],{},[273,1321,1323],{"className":275,"code":1322,"filename":277,"language":278,"meta":279,"style":279},"\u002F\u002F server\u002Fplugins\u002Fevlog-drain.ts\nexport default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('evlog:drain', drain)\n})\n",[257,1324,1325,1329,1349,1375],{"__ignoreMap":279},[283,1326,1327],{"class":285,"line":286},[283,1328,290],{"class":289},[283,1330,1331,1333,1335,1337,1339,1341,1343,1345,1347],{"class":285,"line":293},[283,1332,334],{"class":296},[283,1334,337],{"class":296},[283,1336,341],{"class":340},[283,1338,344],{"class":304},[283,1340,344],{"class":300},[283,1342,350],{"class":349},[283,1344,353],{"class":300},[283,1346,357],{"class":356},[283,1348,360],{"class":300},[283,1350,1351,1353,1355,1357,1359,1361,1363,1365,1367,1369,1371,1373],{"class":285,"line":324},[283,1352,366],{"class":304},[283,1354,369],{"class":300},[283,1356,372],{"class":304},[283,1358,369],{"class":300},[283,1360,377],{"class":340},[283,1362,344],{"class":380},[283,1364,383],{"class":300},[283,1366,386],{"class":317},[283,1368,383],{"class":300},[283,1370,391],{"class":300},[283,1372,455],{"class":304},[283,1374,405],{"class":380},[283,1376,1377,1379],{"class":285,"line":331},[283,1378,402],{"class":300},[283,1380,405],{"class":304},[273,1382,1384],{"className":275,"code":1383,"filename":76,"language":278,"meta":279,"style":279},"app.use(evlog({ drain }))\n",[257,1385,1386],{"__ignoreMap":279},[283,1387,1388,1390,1392,1394,1396,1398,1400,1402,1404,1406],{"class":285,"line":286},[283,1389,437],{"class":304},[283,1391,369],{"class":300},[283,1393,442],{"class":340},[283,1395,344],{"class":304},[283,1397,447],{"class":340},[283,1399,344],{"class":304},[283,1401,452],{"class":300},[283,1403,930],{"class":304},[283,1405,402],{"class":300},[283,1407,468],{"class":304},[273,1409,1410],{"className":275,"code":1383,"filename":71,"language":278,"meta":279,"style":279},[257,1411,1412],{"__ignoreMap":279},[283,1413,1414,1416,1418,1420,1422,1424,1426,1428,1430,1432],{"class":285,"line":286},[283,1415,437],{"class":304},[283,1417,369],{"class":300},[283,1419,442],{"class":340},[283,1421,344],{"class":304},[283,1423,447],{"class":340},[283,1425,344],{"class":304},[283,1427,452],{"class":300},[283,1429,930],{"class":304},[283,1431,402],{"class":300},[283,1433,468],{"class":304},[273,1435,1437],{"className":275,"code":1436,"filename":81,"language":278,"meta":279,"style":279},"await app.register(evlog, { drain })\n",[257,1438,1439],{"__ignoreMap":279},[283,1440,1441,1443,1445,1447,1449,1451,1453,1455,1457,1459],{"class":285,"line":286},[283,1442,554],{"class":296},[283,1444,557],{"class":304},[283,1446,369],{"class":300},[283,1448,562],{"class":340},[283,1450,565],{"class":304},[283,1452,391],{"class":300},[283,1454,301],{"class":300},[283,1456,930],{"class":304},[283,1458,402],{"class":300},[283,1460,405],{"class":304},[273,1462,1463],{"className":275,"code":1383,"filename":86,"language":278,"meta":279,"style":279},[257,1464,1465],{"__ignoreMap":279},[283,1466,1467,1469,1471,1473,1475,1477,1479,1481,1483,1485],{"class":285,"line":286},[283,1468,437],{"class":304},[283,1470,369],{"class":300},[283,1472,442],{"class":340},[283,1474,344],{"class":304},[283,1476,447],{"class":340},[283,1478,344],{"class":304},[283,1480,452],{"class":300},[283,1482,930],{"class":304},[283,1484,402],{"class":300},[283,1486,468],{"class":304},[273,1488,1490],{"className":275,"code":1489,"filename":66,"language":278,"meta":279,"style":279},"EvlogModule.forRoot({ drain })\n",[257,1491,1492],{"__ignoreMap":279},[283,1493,1494,1496,1498,1500,1502,1504,1506,1508],{"class":285,"line":286},[283,1495,667],{"class":304},[283,1497,369],{"class":300},[283,1499,672],{"class":340},[283,1501,344],{"class":304},[283,1503,452],{"class":300},[283,1505,930],{"class":304},[283,1507,402],{"class":300},[283,1509,405],{"class":304},[273,1511,1513],{"className":275,"code":1512,"filename":96,"language":278,"meta":279,"style":279},"initLogger({ drain })\n",[257,1514,1515],{"__ignoreMap":279},[283,1516,1517,1519,1521,1523,1525,1527],{"class":285,"line":286},[283,1518,720],{"class":340},[283,1520,344],{"class":304},[283,1522,452],{"class":300},[283,1524,930],{"class":304},[283,1526,402],{"class":300},[283,1528,405],{"class":304},[249,1530,1532],{"id":1531},"drain-context","Drain Context",[245,1534,1535,1536,1538],{},"Every adapter receives a ",[257,1537,259],{}," with:",[1540,1541,1542,1558],"table",{},[1543,1544,1545],"thead",{},[1546,1547,1548,1552,1555],"tr",{},[1549,1550,1551],"th",{},"Field",[1549,1553,1554],{},"Type",[1549,1556,1557],{},"Description",[1559,1560,1561,1577,1602],"tbody",{},[1546,1562,1563,1569,1574],{},[1564,1565,1566],"td",{},[257,1567,1568],{},"event",[1564,1570,1571],{},[257,1572,1573],{},"WideEvent",[1564,1575,1576],{},"The complete log event with all accumulated context",[1546,1578,1579,1584,1589],{},[1564,1580,1581],{},[257,1582,1583],{},"request",[1564,1585,1586],{},[257,1587,1588],{},"object",[1564,1590,1591,1592,1595,1596,1595,1599,353],{},"Request metadata (",[257,1593,1594],{},"method",", ",[257,1597,1598],{},"path",[257,1600,1601],{},"requestId",[1546,1603,1604,1609,1613],{},[1564,1605,1606],{},[257,1607,1608],{},"headers",[1564,1610,1611],{},[257,1612,1588],{},[1564,1614,1615],{},"Safe HTTP headers (sensitive headers are filtered)",[738,1617,1619,1622,1623,1595,1626,1595,1629,1632],{"color":1618,"icon":134},"success",[262,1620,1621],{},"Security:"," Sensitive headers (",[257,1624,1625],{},"authorization",[257,1627,1628],{},"cookie",[257,1630,1631],{},"x-api-key",", etc.) are automatically filtered and never passed to adapters.",[249,1634,1636],{"id":1635},"zero-config-setup","Zero-Config Setup",[245,1638,1639],{},"All adapters support automatic configuration via environment variables. No code changes needed when deploying to different environments.",[245,1641,1642,1643,1646],{},"Each adapter reads from ",[257,1644,1645],{},"NUXT_*"," prefixed variables (for Nuxt\u002FNitro runtimeConfig) and unprefixed fallbacks (for any framework):",[273,1648,1653],{"className":1649,"code":1650,"filename":1651,"language":1652,"meta":279,"style":279},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","# Axiom (NUXT_AXIOM_* or AXIOM_*)\nAXIOM_TOKEN=xaat-xxx\nAXIOM_DATASET=my-logs\n\n# OTLP (NUXT_OTLP_* or OTEL_*)\nOTLP_ENDPOINT=https:\u002F\u002Fotlp.example.com\n\n# PostHog (NUXT_POSTHOG_* or POSTHOG_*)\nPOSTHOG_API_KEY=phc_xxx\n\n# Sentry (NUXT_SENTRY_* or SENTRY_*)\nSENTRY_DSN=https:\u002F\u002Fkey@o0.ingest.sentry.io\u002F123\n\n# Better Stack (NUXT_BETTER_STACK_* or BETTER_STACK_*)\nBETTER_STACK_SOURCE_TOKEN=your-source-token\n",".env","bash",[257,1654,1655,1660,1670,1680,1684,1689,1699,1703,1708,1718,1722,1727,1737,1741,1746],{"__ignoreMap":279},[283,1656,1657],{"class":285,"line":286},[283,1658,1659],{"class":289},"# Axiom (NUXT_AXIOM_* or AXIOM_*)\n",[283,1661,1662,1665,1667],{"class":285,"line":293},[283,1663,1664],{"class":304},"AXIOM_TOKEN",[283,1666,908],{"class":300},[283,1668,1669],{"class":317},"xaat-xxx\n",[283,1671,1672,1675,1677],{"class":285,"line":324},[283,1673,1674],{"class":304},"AXIOM_DATASET",[283,1676,908],{"class":300},[283,1678,1679],{"class":317},"my-logs\n",[283,1681,1682],{"class":285,"line":331},[283,1683,328],{"emptyLinePlaceholder":327},[283,1685,1686],{"class":285,"line":363},[283,1687,1688],{"class":289},"# OTLP (NUXT_OTLP_* or OTEL_*)\n",[283,1690,1691,1694,1696],{"class":285,"line":399},[283,1692,1693],{"class":304},"OTLP_ENDPOINT",[283,1695,908],{"class":300},[283,1697,1698],{"class":317},"https:\u002F\u002Fotlp.example.com\n",[283,1700,1701],{"class":285,"line":925},[283,1702,328],{"emptyLinePlaceholder":327},[283,1704,1705],{"class":285,"line":945},[283,1706,1707],{"class":289},"# PostHog (NUXT_POSTHOG_* or POSTHOG_*)\n",[283,1709,1710,1713,1715],{"class":285,"line":950},[283,1711,1712],{"class":304},"POSTHOG_API_KEY",[283,1714,908],{"class":300},[283,1716,1717],{"class":317},"phc_xxx\n",[283,1719,1720],{"class":285,"line":960},[283,1721,328],{"emptyLinePlaceholder":327},[283,1723,1724],{"class":285,"line":985},[283,1725,1726],{"class":289},"# Sentry (NUXT_SENTRY_* or SENTRY_*)\n",[283,1728,1729,1732,1734],{"class":285,"line":994},[283,1730,1731],{"class":304},"SENTRY_DSN",[283,1733,908],{"class":300},[283,1735,1736],{"class":317},"https:\u002F\u002Fkey@o0.ingest.sentry.io\u002F123\n",[283,1738,1739],{"class":285,"line":1001},[283,1740,328],{"emptyLinePlaceholder":327},[283,1742,1743],{"class":285,"line":1006},[283,1744,1745],{"class":289},"# Better Stack (NUXT_BETTER_STACK_* or BETTER_STACK_*)\n",[283,1747,1748,1751,1753],{"class":285,"line":1040},[283,1749,1750],{"class":304},"BETTER_STACK_SOURCE_TOKEN",[283,1752,908],{"class":300},[283,1754,1755],{"class":317},"your-source-token\n",[245,1757,1758,1759,1762],{},"Adapters auto-read from these variables, so just call ",[257,1760,1761],{},"createXDrain()"," with no arguments.",[1764,1765,1766],"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 .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 .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":279,"searchDepth":293,"depth":293,"links":1768},[1769,1770,1771,1772,1773,1774],{"id":251,"depth":293,"text":252},{"id":752,"depth":293,"text":753},{"id":787,"depth":293,"text":788},{"id":1165,"depth":293,"text":1166},{"id":1531,"depth":293,"text":1532},{"id":1635,"depth":293,"text":1636},"Send your logs to external services with evlog adapters. Built-in support for popular observability platforms and custom destinations.","md",[1778,1780,1781,1782,1783,1784],{"label":169,"icon":172,"to":170,"color":1152,"variant":1779},"subtle",{"label":174,"icon":177,"to":175,"color":1152,"variant":1779},{"label":179,"icon":182,"to":180,"color":1152,"variant":1779},{"label":184,"icon":187,"to":185,"color":1152,"variant":1779},{"label":189,"icon":192,"to":190,"color":1152,"variant":1779},{"label":194,"icon":197,"to":195,"color":1152,"variant":1779},{},{"title":36,"icon":162},{"title":240,"description":1775},"dTqz3Pbvc06v4ATUU5et6eFaf60b8DsSpqNXevXnOQY",[1790,1792],{"title":150,"path":151,"stem":152,"description":1791,"icon":153,"children":-1},"Complete reference for all evlog configuration options including global logger settings, middleware options, environment context, and framework-specific overrides.",{"title":164,"path":165,"stem":166,"description":1793,"icon":167,"children":-1},"Framework-agnostic browser log transport for sending client-side logs to your server via fetch or sendBeacon. Works with any frontend stack.",1773504115260]