[{"data":1,"prerenderedAt":1196},["ShallowReactive",2],{"navigation_docs":3,"-build-on-top-stream-api":429,"-build-on-top-stream-api-surround":1191},[4,35,159,201,289,326,413],{"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,99,127],{"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},"Catalogs","\u002Flogging\u002Fcatalogs","2.logging\u002F4.catalogs","i-lucide-book-open",{"title":66,"path":67,"stem":68,"icon":69},"Client Logging","\u002Flogging\u002Fclient-logging","2.logging\u002F5.client-logging","i-lucide-monitor",{"title":71,"icon":72,"path":73,"stem":74,"children":75,"page":34},"AI SDK","i-simple-icons-vercel","\u002Flogging\u002Fai-sdk","2.logging\u002F6.ai-sdk",[76,79,84,89,94],{"title":41,"path":77,"stem":78,"icon":44},"\u002Flogging\u002Fai-sdk\u002Foverview","2.logging\u002F6.ai-sdk\u002F01.overview",{"title":80,"path":81,"stem":82,"icon":83},"Usage","\u002Flogging\u002Fai-sdk\u002Fusage","2.logging\u002F6.ai-sdk\u002F02.usage","i-lucide-code",{"title":85,"path":86,"stem":87,"icon":88},"Options","\u002Flogging\u002Fai-sdk\u002Foptions","2.logging\u002F6.ai-sdk\u002F03.options","i-lucide-sliders",{"title":90,"path":91,"stem":92,"icon":93},"Metadata","\u002Flogging\u002Fai-sdk\u002Fmetadata","2.logging\u002F6.ai-sdk\u002F04.metadata","i-lucide-database",{"title":95,"path":96,"stem":97,"icon":98},"Telemetry","\u002Flogging\u002Fai-sdk\u002Ftelemetry","2.logging\u002F6.ai-sdk\u002F05.telemetry","i-lucide-activity",{"title":100,"icon":101,"path":102,"stem":103,"children":104,"page":34},"Better Auth","i-simple-icons-betterauth","\u002Flogging\u002Fbetter-auth","2.logging\u002F7.better-auth",[105,108,113,118,122],{"title":41,"path":106,"stem":107,"icon":44},"\u002Flogging\u002Fbetter-auth\u002Foverview","2.logging\u002F7.better-auth\u002F01.overview",{"title":109,"path":110,"stem":111,"icon":112},"Identify User","\u002Flogging\u002Fbetter-auth\u002Fidentify-user","2.logging\u002F7.better-auth\u002F02.identify-user","i-lucide-user-check",{"title":114,"path":115,"stem":116,"icon":117},"Middleware","\u002Flogging\u002Fbetter-auth\u002Fmiddleware","2.logging\u002F7.better-auth\u002F03.middleware","i-lucide-shield",{"title":119,"path":120,"stem":121,"icon":69},"Client Sync","\u002Flogging\u002Fbetter-auth\u002Fclient-sync","2.logging\u002F7.better-auth\u002F04.client-sync",{"title":123,"path":124,"stem":125,"icon":126},"Performance","\u002Flogging\u002Fbetter-auth\u002Fperformance","2.logging\u002F7.better-auth\u002F05.performance","i-lucide-gauge",{"title":128,"icon":129,"path":130,"stem":131,"children":132,"page":34},"Audit Logs","i-lucide-shield-check","\u002Flogging\u002Faudit","2.logging\u002F8.audit",[133,136,141,146,151,155],{"title":41,"path":134,"stem":135,"icon":44},"\u002Flogging\u002Faudit\u002Foverview","2.logging\u002F8.audit\u002F01.overview",{"title":137,"path":138,"stem":139,"icon":140},"Schema","\u002Flogging\u002Faudit\u002Fschema","2.logging\u002F8.audit\u002F02.schema","i-lucide-file-text",{"title":142,"path":143,"stem":144,"icon":145},"Recording","\u002Flogging\u002Faudit\u002Frecording","2.logging\u002F8.audit\u002F03.recording","i-lucide-pen-line",{"title":147,"path":148,"stem":149,"icon":150},"Drains","\u002Flogging\u002Faudit\u002Fpipeline","2.logging\u002F8.audit\u002F04.pipeline","i-lucide-link",{"title":152,"path":153,"stem":154,"icon":129},"Compliance","\u002Flogging\u002Faudit\u002Fcompliance","2.logging\u002F8.audit\u002F05.compliance",{"title":156,"path":157,"stem":158,"icon":64},"Recipes","\u002Flogging\u002Faudit\u002Frecipes","2.logging\u002F8.audit\u002F06.recipes",{"title":160,"path":161,"stem":162,"children":163,"page":34},"Core Concepts","\u002Fcore-concepts","3.core-concepts",[164,169,174,179,184,188,191,196],{"title":165,"path":166,"stem":167,"icon":168},"Lifecycle","\u002Fcore-concepts\u002Flifecycle","3.core-concepts\u002F0.lifecycle","i-lucide-arrow-right-left",{"title":170,"path":171,"stem":172,"icon":173},"Configuration","\u002Fcore-concepts\u002Fconfiguration","3.core-concepts\u002F1.configuration","i-lucide-settings",{"title":175,"path":176,"stem":177,"icon":178},"Sampling","\u002Fcore-concepts\u002Fsampling","3.core-concepts\u002F2.sampling","i-lucide-filter",{"title":180,"path":181,"stem":182,"icon":183},"Typed Fields","\u002Fcore-concepts\u002Ftyped-fields","3.core-concepts\u002F3.typed-fields","i-simple-icons-typescript",{"title":185,"path":186,"stem":187,"icon":129},"Best Practices","\u002Fcore-concepts\u002Fbest-practices","3.core-concepts\u002F4.best-practices",{"title":123,"path":189,"stem":190,"icon":126},"\u002Fcore-concepts\u002Fperformance","3.core-concepts\u002F5.performance",{"title":192,"path":193,"stem":194,"icon":195},"Vite Plugin","\u002Fcore-concepts\u002Fvite-plugin","3.core-concepts\u002F6.vite-plugin","i-custom-vite",{"title":197,"path":198,"stem":199,"icon":200},"Auto-Redaction","\u002Fcore-concepts\u002Fredaction","3.core-concepts\u002F7.redaction","i-lucide-eye-off",{"title":202,"path":203,"stem":204,"children":205,"page":34},"Frameworks","\u002Fframeworks","4.frameworks",[206,210,215,220,225,230,235,240,245,250,255,260,265,270,274,279,284],{"title":41,"path":207,"stem":208,"icon":209},"\u002Fframeworks\u002Foverview","4.frameworks\u002F00.overview","i-lucide-layout-grid",{"title":211,"path":212,"stem":213,"icon":214},"Nuxt","\u002Fframeworks\u002Fnuxt","4.frameworks\u002F01.nuxt","i-simple-icons-nuxtdotjs",{"title":216,"path":217,"stem":218,"icon":219},"Next.js","\u002Fframeworks\u002Fnextjs","4.frameworks\u002F02.nextjs","i-simple-icons-nextdotjs",{"title":221,"path":222,"stem":223,"icon":224},"SvelteKit","\u002Fframeworks\u002Fsveltekit","4.frameworks\u002F03.sveltekit","i-simple-icons-svelte",{"title":226,"path":227,"stem":228,"icon":229},"Nitro","\u002Fframeworks\u002Fnitro","4.frameworks\u002F04.nitro","i-custom-nitro",{"title":231,"path":232,"stem":233,"icon":234},"TanStack Start","\u002Fframeworks\u002Ftanstack-start","4.frameworks\u002F05.tanstack-start","i-custom-tanstack",{"title":236,"path":237,"stem":238,"icon":239},"NestJS","\u002Fframeworks\u002Fnestjs","4.frameworks\u002F06.nestjs","i-simple-icons-nestjs",{"title":241,"path":242,"stem":243,"icon":244},"Express","\u002Fframeworks\u002Fexpress","4.frameworks\u002F07.express","i-simple-icons-express",{"title":246,"path":247,"stem":248,"icon":249},"Hono","\u002Fframeworks\u002Fhono","4.frameworks\u002F08.hono","i-simple-icons-hono",{"title":251,"path":252,"stem":253,"icon":254},"Fastify","\u002Fframeworks\u002Ffastify","4.frameworks\u002F09.fastify","i-simple-icons-fastify",{"title":256,"path":257,"stem":258,"icon":259},"Elysia","\u002Fframeworks\u002Felysia","4.frameworks\u002F10.elysia","i-custom-elysia",{"title":261,"path":262,"stem":263,"icon":264},"React Router","\u002Fframeworks\u002Freact-router","4.frameworks\u002F11.react-router","i-custom-reactrouter",{"title":266,"path":267,"stem":268,"icon":269},"Cloudflare Workers","\u002Fframeworks\u002Fcloudflare-workers","4.frameworks\u002F12.cloudflare-workers","i-simple-icons-cloudflare",{"title":271,"path":272,"stem":273,"icon":183},"Standalone","\u002Fframeworks\u002Fstandalone","4.frameworks\u002F13.standalone",{"title":275,"path":276,"stem":277,"icon":278},"Astro","\u002Fframeworks\u002Fastro","4.frameworks\u002F14.astro","i-simple-icons-astro",{"title":280,"path":281,"stem":282,"icon":283},"AWS Lambda","\u002Fframeworks\u002Faws-lambda","4.frameworks\u002F16.aws-lambda","i-custom-lambda",{"title":285,"path":286,"stem":287,"icon":288},"Custom Integration","\u002Fframeworks\u002Fcustom-integration","4.frameworks\u002F17.custom-integration","i-lucide-puzzle",{"title":290,"path":291,"stem":292,"children":293,"page":34},"Build on top","\u002Fbuild-on-top","5.build-on-top",[294,297,302,307,312,317,321],{"title":41,"path":295,"stem":296,"icon":54},"\u002Fbuild-on-top\u002Foverview","5.build-on-top\u002F0.overview",{"title":298,"path":299,"stem":300,"icon":301},"Stream API","\u002Fbuild-on-top\u002Fstream-api","5.build-on-top\u002F1.stream-api","i-lucide-radio-tower",{"title":303,"path":304,"stem":305,"icon":306},"Stream server","\u002Fbuild-on-top\u002Fstream-server","5.build-on-top\u002F2.stream-server","i-lucide-radio",{"title":308,"path":309,"stem":310,"icon":311},"FS reader","\u002Fbuild-on-top\u002Ffs-reader","5.build-on-top\u002F3.fs-reader","i-lucide-folder-search",{"title":313,"path":314,"stem":315,"icon":316},"Identity headers","\u002Fbuild-on-top\u002Fidentity-headers","5.build-on-top\u002F4.identity-headers","i-lucide-fingerprint",{"title":156,"path":318,"stem":319,"icon":320},"\u002Fbuild-on-top\u002Frecipes","5.build-on-top\u002F5.recipes","i-lucide-chef-hat",{"title":322,"path":323,"stem":324,"icon":325},"Catalogs as packages","\u002Fbuild-on-top\u002Fcatalogs-as-packages","5.build-on-top\u002F6.catalogs-as-packages","i-lucide-package",{"title":327,"path":328,"stem":329,"children":330,"page":34},"Adapters","\u002Fadapters","6.adapters",[331,334,374,389],{"title":41,"path":332,"stem":333,"icon":44},"\u002Fadapters\u002Foverview","6.adapters\u002F01.overview",{"title":335,"path":336,"stem":337,"children":338,"page":34},"Cloud destinations","\u002Fadapters\u002Fcloud","6.adapters\u002F02.cloud",[339,344,349,354,359,364,369],{"title":340,"path":341,"stem":342,"icon":343},"Axiom","\u002Fadapters\u002Fcloud\u002Faxiom","6.adapters\u002F02.cloud\u002F01.axiom","i-custom-axiom",{"title":345,"path":346,"stem":347,"icon":348},"OTLP","\u002Fadapters\u002Fcloud\u002Fotlp","6.adapters\u002F02.cloud\u002F02.otlp","i-simple-icons-opentelemetry",{"title":350,"path":351,"stem":352,"icon":353},"PostHog","\u002Fadapters\u002Fcloud\u002Fposthog","6.adapters\u002F02.cloud\u002F03.posthog","i-simple-icons-posthog",{"title":355,"path":356,"stem":357,"icon":358},"Sentry","\u002Fadapters\u002Fcloud\u002Fsentry","6.adapters\u002F02.cloud\u002F04.sentry","i-simple-icons-sentry",{"title":360,"path":361,"stem":362,"icon":363},"Better Stack","\u002Fadapters\u002Fcloud\u002Fbetter-stack","6.adapters\u002F02.cloud\u002F05.better-stack","i-simple-icons-betterstack",{"title":365,"path":366,"stem":367,"icon":368},"Datadog","\u002Fadapters\u002Fcloud\u002Fdatadog","6.adapters\u002F02.cloud\u002F06.datadog","i-simple-icons-datadog",{"title":370,"path":371,"stem":372,"icon":373},"HyperDX","\u002Fadapters\u002Fcloud\u002Fhyperdx","6.adapters\u002F02.cloud\u002F07.hyperdx","i-custom-hyperdx",{"title":375,"path":376,"stem":377,"children":378,"page":34},"Self-hosted","\u002Fadapters\u002Fself-hosted","6.adapters\u002F03.self-hosted",[379,384],{"title":380,"path":381,"stem":382,"icon":383},"File System","\u002Fadapters\u002Fself-hosted\u002Ffs","6.adapters\u002F03.self-hosted\u002F01.fs","i-lucide-hard-drive",{"title":385,"path":386,"stem":387,"icon":388},"NuxtHub","\u002Fadapters\u002Fself-hosted\u002Fnuxthub","6.adapters\u002F03.self-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":390,"path":391,"stem":392,"children":393,"page":34},"Building blocks","\u002Fadapters\u002Fbuilding-blocks","6.adapters\u002F04.building-blocks",[394,399,404,408],{"title":395,"path":396,"stem":397,"icon":398},"Pipeline","\u002Fadapters\u002Fbuilding-blocks\u002Fpipeline","6.adapters\u002F04.building-blocks\u002F01.pipeline","i-lucide-workflow",{"title":400,"path":401,"stem":402,"icon":403},"HTTP","\u002Fadapters\u002Fbuilding-blocks\u002Fhttp","6.adapters\u002F04.building-blocks\u002F02.http","i-lucide-globe",{"title":405,"path":406,"stem":407,"icon":83},"Custom Adapters","\u002Fadapters\u002Fbuilding-blocks\u002Fcustom","6.adapters\u002F04.building-blocks\u002F03.custom",{"title":409,"path":410,"stem":411,"icon":412},"Toolkit","\u002Fadapters\u002Fbuilding-blocks\u002Ftoolkit","6.adapters\u002F04.building-blocks\u002F04.toolkit","i-lucide-blocks",{"title":414,"path":415,"stem":416,"children":417,"page":34},"Enrichers","\u002Fenrichers","7.enrichers",[418,421,425],{"title":41,"path":419,"stem":420,"icon":28},"\u002Fenrichers\u002Foverview","7.enrichers\u002F1.overview",{"title":422,"path":423,"stem":424,"icon":288},"Built-in","\u002Fenrichers\u002Fbuilt-in","7.enrichers\u002F2.built-in",{"title":426,"path":427,"stem":428,"icon":83},"Custom","\u002Fenrichers\u002Fcustom","7.enrichers\u002F3.custom",{"id":430,"title":298,"body":431,"description":1184,"extension":1185,"links":1186,"meta":1187,"navigation":1188,"path":299,"seo":1189,"stem":300,"__hash__":1190},"docs\u002F5.build-on-top\u002F1.stream-api.md",{"type":432,"value":433,"toc":1173},"minimark",[434,447,459,596,601,604,609,708,711,715,819,834,838,847,947,951,958,962,968,1040,1044,1052,1136,1146,1150,1169],[435,436,437,441,442,446],"p",{},[438,439,440],"code",{},"createStreamDrain()"," exposes the events flowing through evlog as an ",[443,444,445],"strong",{},"in-process"," pub\u002Fsub. It's the primitive any local consumer can subscribe to without re-implementing a drain.",[448,449,450,456],"callout",{"icon":13},[435,451,452,455],{},[443,453,454],{},"Scope:"," the stream lives inside a single Node \u002F Bun \u002F Deno process. It sees events emitted from that process only.",[435,457,458],{},"That means it works during local development, on long-lived self-hosted servers, and inside containers. On serverless platforms (Vercel Functions, Cloudflare Workers, AWS Lambda…), each invocation is a separate isolate, so a subscriber in one invocation will not see events emitted from another. Use a real broker for cross-instance fan-out.",[460,461,466],"pre",{"className":462,"code":463,"language":464,"meta":465,"style":465},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { createStreamDrain } from 'evlog\u002Fstream'\n\nconst stream = createStreamDrain({ buffer: 200 })\n\n\u002F\u002F Register as a normal evlog drain (Nitro hook or plugin runner):\nnitroApp.hooks.hook('evlog:drain', stream.drain)\n","ts","",[438,467,468,501,508,546,551,558],{"__ignoreMap":465},[469,470,473,477,481,485,488,491,494,498],"span",{"class":471,"line":472},"line",1,[469,474,476],{"class":475},"s7zQu","import",[469,478,480],{"class":479},"sMK4o"," {",[469,482,484],{"class":483},"sTEyZ"," createStreamDrain",[469,486,487],{"class":479}," }",[469,489,490],{"class":475}," from",[469,492,493],{"class":479}," '",[469,495,497],{"class":496},"sfazB","evlog\u002Fstream",[469,499,500],{"class":479},"'\n",[469,502,504],{"class":471,"line":503},2,[469,505,507],{"emptyLinePlaceholder":506},true,"\n",[469,509,511,515,518,521,524,527,530,534,537,541,543],{"class":471,"line":510},3,[469,512,514],{"class":513},"spNyl","const",[469,516,517],{"class":483}," stream ",[469,519,520],{"class":479},"=",[469,522,484],{"class":523},"s2Zo4",[469,525,526],{"class":483},"(",[469,528,529],{"class":479},"{",[469,531,533],{"class":532},"swJcz"," buffer",[469,535,536],{"class":479},":",[469,538,540],{"class":539},"sbssI"," 200",[469,542,487],{"class":479},[469,544,545],{"class":483},")\n",[469,547,549],{"class":471,"line":548},4,[469,550,507],{"emptyLinePlaceholder":506},[469,552,554],{"class":471,"line":553},5,[469,555,557],{"class":556},"sHwdD","\u002F\u002F Register as a normal evlog drain (Nitro hook or plugin runner):\n",[469,559,561,564,567,570,572,575,577,580,583,585,588,591,593],{"class":471,"line":560},6,[469,562,563],{"class":483},"nitroApp",[469,565,566],{"class":479},".",[469,568,569],{"class":483},"hooks",[469,571,566],{"class":479},[469,573,574],{"class":523},"hook",[469,576,526],{"class":483},[469,578,579],{"class":479},"'",[469,581,582],{"class":496},"evlog:drain",[469,584,579],{"class":479},[469,586,587],{"class":479},",",[469,589,590],{"class":483}," stream",[469,592,566],{"class":479},[469,594,595],{"class":483},"drain)\n",[597,598,600],"h2",{"id":599},"subscribing","Subscribing",[435,602,603],{},"Two consumption styles are supported.",[605,606,608],"h3",{"id":607},"sync-listener","Sync listener",[460,610,612],{"className":462,"code":611,"language":464,"meta":465,"style":465},"const unsubscribe = stream.subscribe((event) => {\n  if (event.level === 'error') notifyOps(event)\n})\n\n\u002F\u002F Later:\nunsubscribe()\n",[438,613,614,647,684,691,695,700],{"__ignoreMap":465},[469,615,616,618,621,623,625,627,630,632,634,638,641,644],{"class":471,"line":472},[469,617,514],{"class":513},[469,619,620],{"class":483}," unsubscribe ",[469,622,520],{"class":479},[469,624,590],{"class":483},[469,626,566],{"class":479},[469,628,629],{"class":523},"subscribe",[469,631,526],{"class":483},[469,633,526],{"class":479},[469,635,637],{"class":636},"sHdIc","event",[469,639,640],{"class":479},")",[469,642,643],{"class":513}," =>",[469,645,646],{"class":479}," {\n",[469,648,649,652,655,657,659,662,665,667,670,672,675,678,680,682],{"class":471,"line":503},[469,650,651],{"class":475},"  if",[469,653,654],{"class":532}," (",[469,656,637],{"class":483},[469,658,566],{"class":479},[469,660,661],{"class":483},"level",[469,663,664],{"class":479}," ===",[469,666,493],{"class":479},[469,668,669],{"class":496},"error",[469,671,579],{"class":479},[469,673,674],{"class":532},") ",[469,676,677],{"class":523},"notifyOps",[469,679,526],{"class":532},[469,681,637],{"class":483},[469,683,545],{"class":532},[469,685,686,689],{"class":471,"line":510},[469,687,688],{"class":479},"}",[469,690,545],{"class":483},[469,692,693],{"class":471,"line":548},[469,694,507],{"emptyLinePlaceholder":506},[469,696,697],{"class":471,"line":553},[469,698,699],{"class":556},"\u002F\u002F Later:\n",[469,701,702,705],{"class":471,"line":560},[469,703,704],{"class":523},"unsubscribe",[469,706,707],{"class":483},"()\n",[435,709,710],{},"Listener errors are caught and logged — they never affect other subscribers or the drain.",[605,712,714],{"id":713},"async-iterator","Async iterator",[460,716,718],{"className":462,"code":717,"language":464,"meta":465,"style":465},"for await (const event of stream.events()) {\n  console.log(event.timestamp, event.action ?? event.message)\n  if (shouldStop(event)) break  \u002F\u002F breaking cleanly unsubscribes\n}\n",[438,719,720,751,792,814],{"__ignoreMap":465},[469,721,722,725,728,730,732,735,738,740,742,745,748],{"class":471,"line":472},[469,723,724],{"class":475},"for",[469,726,727],{"class":475}," await",[469,729,654],{"class":483},[469,731,514],{"class":513},[469,733,734],{"class":483}," event ",[469,736,737],{"class":479},"of",[469,739,590],{"class":483},[469,741,566],{"class":479},[469,743,744],{"class":523},"events",[469,746,747],{"class":483},"()) ",[469,749,750],{"class":479},"{\n",[469,752,753,756,758,761,763,765,767,770,772,775,777,780,783,785,787,790],{"class":471,"line":503},[469,754,755],{"class":483},"  console",[469,757,566],{"class":479},[469,759,760],{"class":523},"log",[469,762,526],{"class":532},[469,764,637],{"class":483},[469,766,566],{"class":479},[469,768,769],{"class":483},"timestamp",[469,771,587],{"class":479},[469,773,774],{"class":483}," event",[469,776,566],{"class":479},[469,778,779],{"class":483},"action",[469,781,782],{"class":479}," ??",[469,784,774],{"class":483},[469,786,566],{"class":479},[469,788,789],{"class":483},"message",[469,791,545],{"class":532},[469,793,794,796,798,801,803,805,808,811],{"class":471,"line":510},[469,795,651],{"class":475},[469,797,654],{"class":532},[469,799,800],{"class":523},"shouldStop",[469,802,526],{"class":532},[469,804,637],{"class":483},[469,806,807],{"class":532},")) ",[469,809,810],{"class":475},"break",[469,812,813],{"class":556},"  \u002F\u002F breaking cleanly unsubscribes\n",[469,815,816],{"class":471,"line":548},[469,817,818],{"class":479},"}\n",[435,820,821,822,825,826,829,830,833],{},"Each call to ",[438,823,824],{},"events()"," returns a fresh independent iterator. Past buffered events are ",[443,827,828],{},"not"," replayed; pair with ",[438,831,832],{},"stream.recent()"," to seed history.",[597,835,837],{"id":836},"replay-buffer","Replay buffer",[435,839,840,842,843,846],{},[438,841,832],{}," returns a defensive copy of the most recent events (oldest first). The default buffer holds 500 events; pass ",[438,844,845],{},"buffer: 0"," to disable, or set it explicitly:",[460,848,850],{"className":462,"code":849,"language":464,"meta":465,"style":465},"const stream = createStreamDrain({ buffer: 1000 })\n\nconst initial = stream.recent()\nfor (const past of initial) seedDashboard(past)\n\nstream.subscribe(liveEvent => updateDashboard(liveEvent))\n",[438,851,852,877,881,899,921,925],{"__ignoreMap":465},[469,853,854,856,858,860,862,864,866,868,870,873,875],{"class":471,"line":472},[469,855,514],{"class":513},[469,857,517],{"class":483},[469,859,520],{"class":479},[469,861,484],{"class":523},[469,863,526],{"class":483},[469,865,529],{"class":479},[469,867,533],{"class":532},[469,869,536],{"class":479},[469,871,872],{"class":539}," 1000",[469,874,487],{"class":479},[469,876,545],{"class":483},[469,878,879],{"class":471,"line":503},[469,880,507],{"emptyLinePlaceholder":506},[469,882,883,885,888,890,892,894,897],{"class":471,"line":510},[469,884,514],{"class":513},[469,886,887],{"class":483}," initial ",[469,889,520],{"class":479},[469,891,590],{"class":483},[469,893,566],{"class":479},[469,895,896],{"class":523},"recent",[469,898,707],{"class":483},[469,900,901,903,905,907,910,912,915,918],{"class":471,"line":548},[469,902,724],{"class":475},[469,904,654],{"class":483},[469,906,514],{"class":513},[469,908,909],{"class":483}," past ",[469,911,737],{"class":479},[469,913,914],{"class":483}," initial) ",[469,916,917],{"class":523},"seedDashboard",[469,919,920],{"class":483},"(past)\n",[469,922,923],{"class":471,"line":553},[469,924,507],{"emptyLinePlaceholder":506},[469,926,927,930,932,934,936,939,941,944],{"class":471,"line":560},[469,928,929],{"class":483},"stream",[469,931,566],{"class":479},[469,933,629],{"class":523},[469,935,526],{"class":483},[469,937,938],{"class":636},"liveEvent",[469,940,643],{"class":513},[469,942,943],{"class":523}," updateDashboard",[469,945,946],{"class":483},"(liveEvent))\n",[597,948,950],{"id":949},"backpressure","Backpressure",[435,952,953,954,957],{},"A slow async-iterator consumer never blocks the drain. Each iterator has a per-subscriber queue (default 1000); when it overflows, the oldest queued events are dropped and ",[438,955,956],{},"stream.droppedCount"," increments.",[597,959,961],{"id":960},"filter","Filter",[435,963,964,965,967],{},"Events that fail the optional ",[438,966,960],{}," predicate are not buffered nor delivered:",[460,969,971],{"className":462,"code":970,"language":464,"meta":465,"style":465},"const errors = createStreamDrain({\n  filter: event => event.level === 'error' || event.status >= 500,\n})\n",[438,972,973,988,1034],{"__ignoreMap":465},[469,974,975,977,980,982,984,986],{"class":471,"line":472},[469,976,514],{"class":513},[469,978,979],{"class":483}," errors ",[469,981,520],{"class":479},[469,983,484],{"class":523},[469,985,526],{"class":483},[469,987,750],{"class":479},[469,989,990,993,995,997,999,1001,1003,1006,1009,1011,1013,1015,1018,1020,1022,1025,1028,1031],{"class":471,"line":503},[469,991,992],{"class":523},"  filter",[469,994,536],{"class":479},[469,996,774],{"class":636},[469,998,643],{"class":513},[469,1000,774],{"class":483},[469,1002,566],{"class":479},[469,1004,1005],{"class":483},"level ",[469,1007,1008],{"class":479},"===",[469,1010,493],{"class":479},[469,1012,669],{"class":496},[469,1014,579],{"class":479},[469,1016,1017],{"class":479}," ||",[469,1019,774],{"class":483},[469,1021,566],{"class":479},[469,1023,1024],{"class":483},"status ",[469,1026,1027],{"class":479},">=",[469,1029,1030],{"class":539}," 500",[469,1032,1033],{"class":479},",\n",[469,1035,1036,1038],{"class":471,"line":510},[469,1037,688],{"class":479},[469,1039,545],{"class":483},[597,1041,1043],{"id":1042},"default-singleton","Default singleton",[435,1045,1046,1047,1051],{},"When several pieces of code in the same process need to share a single stream — typically a framework integration that wires the drain on one side and the ",[1048,1049,1050],"a",{"href":304},"stream server"," on the other — use the singleton accessors:",[460,1053,1055],{"className":462,"code":1054,"language":464,"meta":465,"style":465},"import { getDefaultStream, setDefaultStream } from 'evlog\u002Fstream'\n\n\u002F\u002F Lazily creates a singleton on first call\nconst stream = getDefaultStream({ buffer: 500 })\n\n\u002F\u002F Reset (mostly useful in tests)\nsetDefaultStream(null)\n",[438,1056,1057,1081,1085,1090,1114,1118,1123],{"__ignoreMap":465},[469,1058,1059,1061,1063,1066,1068,1071,1073,1075,1077,1079],{"class":471,"line":472},[469,1060,476],{"class":475},[469,1062,480],{"class":479},[469,1064,1065],{"class":483}," getDefaultStream",[469,1067,587],{"class":479},[469,1069,1070],{"class":483}," setDefaultStream",[469,1072,487],{"class":479},[469,1074,490],{"class":475},[469,1076,493],{"class":479},[469,1078,497],{"class":496},[469,1080,500],{"class":479},[469,1082,1083],{"class":471,"line":503},[469,1084,507],{"emptyLinePlaceholder":506},[469,1086,1087],{"class":471,"line":510},[469,1088,1089],{"class":556},"\u002F\u002F Lazily creates a singleton on first call\n",[469,1091,1092,1094,1096,1098,1100,1102,1104,1106,1108,1110,1112],{"class":471,"line":548},[469,1093,514],{"class":513},[469,1095,517],{"class":483},[469,1097,520],{"class":479},[469,1099,1065],{"class":523},[469,1101,526],{"class":483},[469,1103,529],{"class":479},[469,1105,533],{"class":532},[469,1107,536],{"class":479},[469,1109,1030],{"class":539},[469,1111,487],{"class":479},[469,1113,545],{"class":483},[469,1115,1116],{"class":471,"line":553},[469,1117,507],{"emptyLinePlaceholder":506},[469,1119,1120],{"class":471,"line":560},[469,1121,1122],{"class":556},"\u002F\u002F Reset (mostly useful in tests)\n",[469,1124,1126,1129,1131,1134],{"class":471,"line":1125},7,[469,1127,1128],{"class":523},"setDefaultStream",[469,1130,526],{"class":483},[469,1132,1133],{"class":479},"null",[469,1135,545],{"class":483},[435,1137,1138,1139,1141,1142,1145],{},"The mini ",[1048,1140,1050],{"href":304}," uses this singleton internally, so anything draining into ",[438,1143,1144],{},"getDefaultStream()"," automatically reaches all SSE clients.",[597,1147,1149],{"id":1148},"going-further","Going further",[1151,1152,1153,1162],"ul",{},[1154,1155,1156,1159,1160,566],"li",{},[443,1157,1158],{},"Network bridge"," — expose this stream over HTTP for browser tabs \u002F CLIs \u002F external devtools. See the ",[1048,1161,303],{"href":304},[1154,1163,1164,1166,1167,566],{},[443,1165,156],{}," — concrete consumer patterns (devtool, replay-then-live, aggregation). See ",[1048,1168,156],{"href":318},[1170,1171,1172],"style",{},"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 .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}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 .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 .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}",{"title":465,"searchDepth":503,"depth":503,"links":1174},[1175,1179,1180,1181,1182,1183],{"id":599,"depth":503,"text":600,"children":1176},[1177,1178],{"id":607,"depth":510,"text":608},{"id":713,"depth":510,"text":714},{"id":836,"depth":503,"text":837},{"id":949,"depth":503,"text":950},{"id":960,"depth":503,"text":961},{"id":1042,"depth":503,"text":1043},{"id":1148,"depth":503,"text":1149},"Subscribe to wide events flowing through evlog, in-process, with createStreamDrain — sync listeners, async iterators, and a ring buffer.","md",null,{},{"title":298,"icon":301},{"title":298,"description":1184},"1JVBdHqaMw2_etMWbj5FDL6y823fsn6Q6kuk7fo-5Vg",[1192,1194],{"title":41,"path":295,"stem":296,"description":1193,"icon":54,"children":-1},"Two ways to build on top of evlog — observe the events flowing through the pipeline, or extend the pipeline itself with custom plugins, drains, enrichers, and shareable catalogs.",{"title":303,"path":304,"stem":305,"description":1195,"icon":306,"children":-1},"A local HTTP mini-server on its own port that exposes the in-process stream over Server-Sent Events. Strict opt-in, framework-agnostic, no app route to wire.",1778336626423]