[{"data":1,"prerenderedAt":2660},["ShallowReactive",2],{"navigation_docs":3,"-core-concepts-sampling":308,"-core-concepts-sampling-surround":2655},[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":96,"body":310,"description":2644,"extension":2645,"links":2646,"meta":2651,"navigation":2652,"path":97,"seo":2653,"stem":98,"__hash__":2654},"docs\u002F3.core-concepts\u002F2.sampling.md",{"type":311,"value":312,"toc":2634},"minimark",[313,317,365,370,378,859,866,875,879,886,1013,1036,1041,1113,1117,1120,1151,1161,1366,1370,1380,1830,1836,1941,1945,1948,2605,2614,2618,2630],[314,315,316],"p",{},"At scale, logging everything gets expensive fast. Sampling lets you keep costs under control without losing visibility into what matters. evlog uses a two-tier approach: head sampling drops noise upfront, tail sampling rescues critical events after the fact.",[318,319,322,325,351],"prompt",{":actions":320,"description":321,"icon":99},"[\"copy\",\"cursor\",\"windsurf\"]","Enable head and tail sampling",[314,323,324],{},"Enable head and tail sampling in my evlog production config.",[326,327,328,332,335,342,345,348],"ul",{},[329,330,331],"li",{},"Identify my framework and locate the evlog config (nuxt.config.ts, lib\u002Fevlog.ts, initLogger, etc.)",[329,333,334],{},"Configure sampling.rates per level: { info: 10, warn: 50, debug: 0, error: 100 } as a starting point",[329,336,337,338],{},"Add sampling.keep rules to force-keep critical events: ",[339,340,341],"span",{},"{ status: 400 }, { duration: 1000 }, { path: '\u002Fapi\u002Fcritical\u002F**' }",[329,343,344],{},"For business-specific keep logic (e.g. premium users), add a custom keep callback or evlog:emit:keep hook",[329,346,347],{},"Wrap sampling in a $production override so dev keeps full logging",[329,349,350],{},"Confirm errors are always kept by default unless I explicitly set error: 0",[314,352,353,354,360,361],{},"Docs: ",[355,356,357],"a",{"href":357,"rel":358},"https:\u002F\u002Fwww.evlog.dev\u002Fcore-concepts\u002Fsampling",[359],"nofollow","\nBest practices: ",[355,362,363],{"href":363,"rel":364},"https:\u002F\u002Fwww.evlog.dev\u002Fcore-concepts\u002Fbest-practices",[359],[366,367,369],"h2",{"id":368},"head-sampling","Head Sampling",[314,371,372,373,377],{},"Head sampling randomly keeps a percentage of logs per level. It runs ",[374,375,376],"strong",{},"before"," the request completes, acting as a coin flip at emission time.",[379,380,381,568,727],"code-group",{},[382,383,389],"pre",{"className":384,"code":385,"filename":386,"language":387,"meta":388,"style":388},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","export default defineNuxtConfig({\n  modules: ['evlog\u002Fnuxt'],\n  evlog: {\n    sampling: {\n      rates: {\n        info: 10,    \u002F\u002F Keep 10% of info logs\n        warn: 50,    \u002F\u002F Keep 50% of warnings\n        debug: 0,    \u002F\u002F Drop all debug logs\n        error: 100,  \u002F\u002F Always keep errors (default)\n      },\n    },\n  },\n})\n","nuxt.config.ts","typescript","",[390,391,392,415,443,454,464,474,493,509,525,541,547,553,559],"code",{"__ignoreMap":388},[339,393,396,400,403,407,411],{"class":394,"line":395},"line",1,[339,397,399],{"class":398},"s7zQu","export",[339,401,402],{"class":398}," default",[339,404,406],{"class":405},"s2Zo4"," defineNuxtConfig",[339,408,410],{"class":409},"sTEyZ","(",[339,412,414],{"class":413},"sMK4o","{\n",[339,416,418,422,425,428,431,435,437,440],{"class":394,"line":417},2,[339,419,421],{"class":420},"swJcz","  modules",[339,423,424],{"class":413},":",[339,426,427],{"class":409}," [",[339,429,430],{"class":413},"'",[339,432,434],{"class":433},"sfazB","evlog\u002Fnuxt",[339,436,430],{"class":413},[339,438,439],{"class":409},"]",[339,441,442],{"class":413},",\n",[339,444,446,449,451],{"class":394,"line":445},3,[339,447,448],{"class":420},"  evlog",[339,450,424],{"class":413},[339,452,453],{"class":413}," {\n",[339,455,457,460,462],{"class":394,"line":456},4,[339,458,459],{"class":420},"    sampling",[339,461,424],{"class":413},[339,463,453],{"class":413},[339,465,467,470,472],{"class":394,"line":466},5,[339,468,469],{"class":420},"      rates",[339,471,424],{"class":413},[339,473,453],{"class":413},[339,475,477,480,482,486,489],{"class":394,"line":476},6,[339,478,479],{"class":420},"        info",[339,481,424],{"class":413},[339,483,485],{"class":484},"sbssI"," 10",[339,487,488],{"class":413},",",[339,490,492],{"class":491},"sHwdD","    \u002F\u002F Keep 10% of info logs\n",[339,494,496,499,501,504,506],{"class":394,"line":495},7,[339,497,498],{"class":420},"        warn",[339,500,424],{"class":413},[339,502,503],{"class":484}," 50",[339,505,488],{"class":413},[339,507,508],{"class":491},"    \u002F\u002F Keep 50% of warnings\n",[339,510,512,515,517,520,522],{"class":394,"line":511},8,[339,513,514],{"class":420},"        debug",[339,516,424],{"class":413},[339,518,519],{"class":484}," 0",[339,521,488],{"class":413},[339,523,524],{"class":491},"    \u002F\u002F Drop all debug logs\n",[339,526,528,531,533,536,538],{"class":394,"line":527},9,[339,529,530],{"class":420},"        error",[339,532,424],{"class":413},[339,534,535],{"class":484}," 100",[339,537,488],{"class":413},[339,539,540],{"class":491},"  \u002F\u002F Always keep errors (default)\n",[339,542,544],{"class":394,"line":543},10,[339,545,546],{"class":413},"      },\n",[339,548,550],{"class":394,"line":549},11,[339,551,552],{"class":413},"    },\n",[339,554,556],{"class":394,"line":555},12,[339,557,558],{"class":413},"  },\n",[339,560,562,565],{"class":394,"line":561},13,[339,563,564],{"class":413},"}",[339,566,567],{"class":409},")\n",[382,569,572],{"className":384,"code":570,"filename":571,"language":387,"meta":388,"style":388},"import { createEvlog } from 'evlog\u002Fnext'\n\nexport const { withEvlog, useLogger } = createEvlog({\n  service: 'my-app',\n  sampling: {\n    rates: {\n      info: 10,\n      warn: 50,\n      debug: 0,\n      error: 100,\n    },\n  },\n})\n","lib\u002Fevlog.ts (Next.js)",[390,573,574,600,606,635,651,660,669,680,691,702,713,717,721],{"__ignoreMap":388},[339,575,576,579,582,585,588,591,594,597],{"class":394,"line":395},[339,577,578],{"class":398},"import",[339,580,581],{"class":413}," {",[339,583,584],{"class":409}," createEvlog",[339,586,587],{"class":413}," }",[339,589,590],{"class":398}," from",[339,592,593],{"class":413}," '",[339,595,596],{"class":433},"evlog\u002Fnext",[339,598,599],{"class":413},"'\n",[339,601,602],{"class":394,"line":417},[339,603,605],{"emptyLinePlaceholder":604},true,"\n",[339,607,608,610,614,616,619,621,624,626,629,631,633],{"class":394,"line":445},[339,609,399],{"class":398},[339,611,613],{"class":612},"spNyl"," const",[339,615,581],{"class":413},[339,617,618],{"class":409}," withEvlog",[339,620,488],{"class":413},[339,622,623],{"class":409}," useLogger ",[339,625,564],{"class":413},[339,627,628],{"class":413}," =",[339,630,584],{"class":405},[339,632,410],{"class":409},[339,634,414],{"class":413},[339,636,637,640,642,644,647,649],{"class":394,"line":456},[339,638,639],{"class":420},"  service",[339,641,424],{"class":413},[339,643,593],{"class":413},[339,645,646],{"class":433},"my-app",[339,648,430],{"class":413},[339,650,442],{"class":413},[339,652,653,656,658],{"class":394,"line":466},[339,654,655],{"class":420},"  sampling",[339,657,424],{"class":413},[339,659,453],{"class":413},[339,661,662,665,667],{"class":394,"line":476},[339,663,664],{"class":420},"    rates",[339,666,424],{"class":413},[339,668,453],{"class":413},[339,670,671,674,676,678],{"class":394,"line":495},[339,672,673],{"class":420},"      info",[339,675,424],{"class":413},[339,677,485],{"class":484},[339,679,442],{"class":413},[339,681,682,685,687,689],{"class":394,"line":511},[339,683,684],{"class":420},"      warn",[339,686,424],{"class":413},[339,688,503],{"class":484},[339,690,442],{"class":413},[339,692,693,696,698,700],{"class":394,"line":527},[339,694,695],{"class":420},"      debug",[339,697,424],{"class":413},[339,699,519],{"class":484},[339,701,442],{"class":413},[339,703,704,707,709,711],{"class":394,"line":543},[339,705,706],{"class":420},"      error",[339,708,424],{"class":413},[339,710,535],{"class":484},[339,712,442],{"class":413},[339,714,715],{"class":394,"line":549},[339,716,552],{"class":413},[339,718,719],{"class":394,"line":555},[339,720,558],{"class":413},[339,722,723,725],{"class":394,"line":561},[339,724,564],{"class":413},[339,726,567],{"class":409},[382,728,731],{"className":384,"code":729,"filename":730,"language":387,"meta":388,"style":388},"import { initLogger } from 'evlog'\n\ninitLogger({\n  env: { service: 'my-app' },\n  sampling: {\n    rates: {\n      info: 10,\n      warn: 50,\n      debug: 0,\n      error: 100,\n    },\n  },\n})\n","index.ts (Hono \u002F Express \u002F Fastify)",[390,732,733,753,757,766,789,797,805,815,825,835,845,849,853],{"__ignoreMap":388},[339,734,735,737,739,742,744,746,748,751],{"class":394,"line":395},[339,736,578],{"class":398},[339,738,581],{"class":413},[339,740,741],{"class":409}," initLogger",[339,743,587],{"class":413},[339,745,590],{"class":398},[339,747,593],{"class":413},[339,749,750],{"class":433},"evlog",[339,752,599],{"class":413},[339,754,755],{"class":394,"line":417},[339,756,605],{"emptyLinePlaceholder":604},[339,758,759,762,764],{"class":394,"line":445},[339,760,761],{"class":405},"initLogger",[339,763,410],{"class":409},[339,765,414],{"class":413},[339,767,768,771,773,775,778,780,782,784,786],{"class":394,"line":456},[339,769,770],{"class":420},"  env",[339,772,424],{"class":413},[339,774,581],{"class":413},[339,776,777],{"class":420}," service",[339,779,424],{"class":413},[339,781,593],{"class":413},[339,783,646],{"class":433},[339,785,430],{"class":413},[339,787,788],{"class":413}," },\n",[339,790,791,793,795],{"class":394,"line":466},[339,792,655],{"class":420},[339,794,424],{"class":413},[339,796,453],{"class":413},[339,798,799,801,803],{"class":394,"line":476},[339,800,664],{"class":420},[339,802,424],{"class":413},[339,804,453],{"class":413},[339,806,807,809,811,813],{"class":394,"line":495},[339,808,673],{"class":420},[339,810,424],{"class":413},[339,812,485],{"class":484},[339,814,442],{"class":413},[339,816,817,819,821,823],{"class":394,"line":511},[339,818,684],{"class":420},[339,820,424],{"class":413},[339,822,503],{"class":484},[339,824,442],{"class":413},[339,826,827,829,831,833],{"class":394,"line":527},[339,828,695],{"class":420},[339,830,424],{"class":413},[339,832,519],{"class":484},[339,834,442],{"class":413},[339,836,837,839,841,843],{"class":394,"line":543},[339,838,706],{"class":420},[339,840,424],{"class":413},[339,842,535],{"class":484},[339,844,442],{"class":413},[339,846,847],{"class":394,"line":549},[339,848,552],{"class":413},[339,850,851],{"class":394,"line":555},[339,852,558],{"class":413},[339,854,855,857],{"class":394,"line":561},[339,856,564],{"class":413},[339,858,567],{"class":409},[314,860,861,862,865],{},"Each level is a percentage from 0 to 100. Levels you don't configure default to 100% (keep everything). Error defaults to 100% even when other levels are configured, so you have to explicitly set ",[390,863,864],{},"error: 0"," to drop errors.",[867,868,870,871,874],"callout",{"color":869,"icon":13},"info","Head sampling is random. A ",[390,872,873],{},"10%"," rate means roughly 1 in 10 info logs are kept, not exactly 1 in 10.",[366,876,878],{"id":877},"tail-sampling","Tail Sampling",[314,880,881,882,885],{},"Head sampling is blind: it doesn't know if a request was slow, failed, or hit a critical path. Tail sampling fixes this by evaluating ",[374,883,884],{},"after"," the request completes and force-keeping logs that match specific conditions.",[382,887,889],{"className":384,"code":888,"filename":386,"language":387,"meta":388,"style":388},"\u002F\u002F Sampling config, works the same across all frameworks\nevlog: {\n  sampling: {\n    rates: { info: 10 },\n    keep: [\n      { status: 400 },              \u002F\u002F HTTP status >= 400\n      { duration: 1000 },           \u002F\u002F Request took >= 1s\n      { path: '\u002Fapi\u002Fpayments\u002F**' }, \u002F\u002F Critical path (glob)\n    ],\n  },\n}\n",[390,890,891,896,905,913,930,940,959,976,997,1004,1008],{"__ignoreMap":388},[339,892,893],{"class":394,"line":395},[339,894,895],{"class":491},"\u002F\u002F Sampling config, works the same across all frameworks\n",[339,897,898,901,903],{"class":394,"line":417},[339,899,750],{"class":900},"sBMFI",[339,902,424],{"class":413},[339,904,453],{"class":413},[339,906,907,909,911],{"class":394,"line":445},[339,908,655],{"class":900},[339,910,424],{"class":413},[339,912,453],{"class":413},[339,914,915,917,919,921,924,926,928],{"class":394,"line":456},[339,916,664],{"class":900},[339,918,424],{"class":413},[339,920,581],{"class":413},[339,922,923],{"class":900}," info",[339,925,424],{"class":413},[339,927,485],{"class":484},[339,929,788],{"class":413},[339,931,932,935,937],{"class":394,"line":466},[339,933,934],{"class":900},"    keep",[339,936,424],{"class":413},[339,938,939],{"class":420}," [\n",[339,941,942,945,948,950,953,956],{"class":394,"line":476},[339,943,944],{"class":413},"      {",[339,946,947],{"class":420}," status",[339,949,424],{"class":413},[339,951,952],{"class":484}," 400",[339,954,955],{"class":413}," },",[339,957,958],{"class":491},"              \u002F\u002F HTTP status >= 400\n",[339,960,961,963,966,968,971,973],{"class":394,"line":495},[339,962,944],{"class":413},[339,964,965],{"class":420}," duration",[339,967,424],{"class":413},[339,969,970],{"class":484}," 1000",[339,972,955],{"class":413},[339,974,975],{"class":491},"           \u002F\u002F Request took >= 1s\n",[339,977,978,980,983,985,987,990,992,994],{"class":394,"line":511},[339,979,944],{"class":413},[339,981,982],{"class":420}," path",[339,984,424],{"class":413},[339,986,593],{"class":413},[339,988,989],{"class":433},"\u002Fapi\u002Fpayments\u002F**",[339,991,430],{"class":413},[339,993,955],{"class":413},[339,995,996],{"class":491}," \u002F\u002F Critical path (glob)\n",[339,998,999,1002],{"class":394,"line":527},[339,1000,1001],{"class":420},"    ]",[339,1003,442],{"class":413},[339,1005,1006],{"class":394,"line":543},[339,1007,558],{"class":413},[339,1009,1010],{"class":394,"line":549},[339,1011,1012],{"class":413},"}\n",[314,1014,1015,1016,1019,1020,1023,1024,1027,1028,1031,1032,1035],{},"Conditions use ",[374,1017,1018],{},">="," comparison for ",[390,1021,1022],{},"status"," and ",[390,1025,1026],{},"duration",", and glob matching for ",[390,1029,1030],{},"path",". If ",[374,1033,1034],{},"any"," condition matches, the log is kept regardless of head sampling (OR logic).",[1037,1038,1040],"h3",{"id":1039},"available-conditions","Available Conditions",[1042,1043,1044,1060],"table",{},[1045,1046,1047],"thead",{},[1048,1049,1050,1054,1057],"tr",{},[1051,1052,1053],"th",{},"Condition",[1051,1055,1056],{},"Type",[1051,1058,1059],{},"Description",[1061,1062,1063,1082,1095],"tbody",{},[1048,1064,1065,1070,1075],{},[1066,1067,1068],"td",{},[390,1069,1022],{},[1066,1071,1072],{},[390,1073,1074],{},"number",[1066,1076,1077,1078,1081],{},"Keep if HTTP status >= value (e.g., ",[390,1079,1080],{},"400"," catches all 4xx and 5xx)",[1048,1083,1084,1088,1092],{},[1066,1085,1086],{},[390,1087,1026],{},[1066,1089,1090],{},[390,1091,1074],{},[1066,1093,1094],{},"Keep if request duration >= value in milliseconds",[1048,1096,1097,1101,1106],{},[1066,1098,1099],{},[390,1100,1030],{},[1066,1102,1103],{},[390,1104,1105],{},"string",[1066,1107,1108,1109,1112],{},"Keep if request path matches glob pattern (e.g., ",[390,1110,1111],{},"'\u002Fapi\u002Fcritical\u002F**'",")",[366,1114,1116],{"id":1115},"how-they-work-together","How They Work Together",[314,1118,1119],{},"The two tiers complement each other:",[1121,1122,1123,1129,1139,1145],"ol",{},[329,1124,1125,1128],{},[374,1126,1127],{},"Request completes"," - evlog knows the status, duration, and path",[329,1130,1131,1134,1135,1138],{},[374,1132,1133],{},"Tail sampling evaluates"," - if any ",[390,1136,1137],{},"keep"," condition matches, the log is force-kept",[329,1140,1141,1144],{},[374,1142,1143],{},"Head sampling applies"," - only if tail sampling didn't force-keep, the random percentage check runs",[329,1146,1147,1150],{},[374,1148,1149],{},"Log emits or drops"," - kept logs go through enrichment and draining as normal",[314,1152,1153,1154,1157,1158,1160],{},"This means a request to ",[390,1155,1156],{},"\u002Fapi\u002Fpayments\u002Fcharge"," that returns a 500 in 2 seconds will always be logged, even if ",[390,1159,869],{}," is set to 1%. The tail conditions rescue it.",[379,1162,1163,1239],{},[382,1164,1166],{"className":384,"code":1165,"filename":91,"language":387,"meta":388,"style":388},"sampling: {\n  rates: { info: 10 },\n  keep: [\n    { status: 400 },\n    { duration: 1000 },\n  ],\n}\n",[390,1167,1168,1177,1194,1203,1216,1228,1235],{"__ignoreMap":388},[339,1169,1170,1173,1175],{"class":394,"line":395},[339,1171,1172],{"class":900},"sampling",[339,1174,424],{"class":413},[339,1176,453],{"class":413},[339,1178,1179,1182,1184,1186,1188,1190,1192],{"class":394,"line":417},[339,1180,1181],{"class":900},"  rates",[339,1183,424],{"class":413},[339,1185,581],{"class":413},[339,1187,923],{"class":900},[339,1189,424],{"class":413},[339,1191,485],{"class":484},[339,1193,788],{"class":413},[339,1195,1196,1199,1201],{"class":394,"line":445},[339,1197,1198],{"class":900},"  keep",[339,1200,424],{"class":413},[339,1202,939],{"class":420},[339,1204,1205,1208,1210,1212,1214],{"class":394,"line":456},[339,1206,1207],{"class":413},"    {",[339,1209,947],{"class":420},[339,1211,424],{"class":413},[339,1213,952],{"class":484},[339,1215,788],{"class":413},[339,1217,1218,1220,1222,1224,1226],{"class":394,"line":466},[339,1219,1207],{"class":413},[339,1221,965],{"class":420},[339,1223,424],{"class":413},[339,1225,970],{"class":484},[339,1227,788],{"class":413},[339,1229,1230,1233],{"class":394,"line":476},[339,1231,1232],{"class":420},"  ]",[339,1234,442],{"class":413},[339,1236,1237],{"class":394,"line":495},[339,1238,1012],{"class":413},[382,1240,1245],{"className":1241,"code":1242,"filename":1243,"language":1244,"meta":388,"style":388},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","POST \u002Fapi\u002Fusers     200  45ms   → 10% chance (head sampling)\nPOST \u002Fapi\u002Fusers     500  45ms   → always kept (status >= 400)\nGET  \u002Fapi\u002Fproducts  200  2300ms → always kept (duration >= 1000)\nPOST \u002Fapi\u002Fcheckout  200  120ms  → 10% chance (head sampling)\n","What gets logged","bash",[390,1246,1247,1277,1309,1341],{"__ignoreMap":388},[339,1248,1249,1252,1255,1258,1261,1264,1267,1270,1273,1275],{"class":394,"line":395},[339,1250,1251],{"class":900},"POST",[339,1253,1254],{"class":433}," \u002Fapi\u002Fusers",[339,1256,1257],{"class":484},"     200",[339,1259,1260],{"class":433},"  45ms",[339,1262,1263],{"class":433},"   →",[339,1265,1266],{"class":433}," 10%",[339,1268,1269],{"class":433}," chance",[339,1271,1272],{"class":409}," (head ",[339,1274,1172],{"class":433},[339,1276,567],{"class":409},[339,1278,1279,1281,1283,1286,1288,1290,1293,1296,1299,1302,1305,1307],{"class":394,"line":417},[339,1280,1251],{"class":900},[339,1282,1254],{"class":433},[339,1284,1285],{"class":484},"     500",[339,1287,1260],{"class":433},[339,1289,1263],{"class":433},[339,1291,1292],{"class":433}," always",[339,1294,1295],{"class":433}," kept",[339,1297,1298],{"class":409}," (status ",[339,1300,1301],{"class":413},">",[339,1303,1304],{"class":433},"=",[339,1306,952],{"class":484},[339,1308,567],{"class":409},[339,1310,1311,1314,1317,1320,1323,1326,1328,1330,1333,1335,1337,1339],{"class":394,"line":445},[339,1312,1313],{"class":900},"GET",[339,1315,1316],{"class":433},"  \u002Fapi\u002Fproducts",[339,1318,1319],{"class":484},"  200",[339,1321,1322],{"class":433},"  2300ms",[339,1324,1325],{"class":433}," →",[339,1327,1292],{"class":433},[339,1329,1295],{"class":433},[339,1331,1332],{"class":409}," (duration ",[339,1334,1301],{"class":413},[339,1336,1304],{"class":433},[339,1338,970],{"class":484},[339,1340,567],{"class":409},[339,1342,1343,1345,1348,1350,1353,1356,1358,1360,1362,1364],{"class":394,"line":456},[339,1344,1251],{"class":900},[339,1346,1347],{"class":433}," \u002Fapi\u002Fcheckout",[339,1349,1319],{"class":484},[339,1351,1352],{"class":433},"  120ms",[339,1354,1355],{"class":433},"  →",[339,1357,1266],{"class":433},[339,1359,1269],{"class":433},[339,1361,1272],{"class":409},[339,1363,1172],{"class":433},[339,1365,567],{"class":409},[366,1367,1369],{"id":1368},"custom-tail-sampling","Custom Tail Sampling",[314,1371,1372,1373,1376,1377,1379],{},"For conditions beyond status, duration, and path, use the ",[390,1374,1375],{},"evlog:emit:keep"," hook in Nuxt\u002FNitro or the ",[390,1378,1137],{}," callback in other frameworks.",[379,1381,1382,1524,1711],{},[382,1383,1386],{"className":384,"code":1384,"filename":1385,"language":387,"meta":388,"style":388},"export default defineNitroPlugin((nitroApp) => {\n  nitroApp.hooks.hook('evlog:emit:keep', (ctx) => {\n    if (ctx.context.user?.plan === 'enterprise') {\n      ctx.shouldKeep = true\n    }\n  })\n})\n","server\u002Fplugins\u002Fsampling.ts (Nuxt)",[390,1387,1388,1412,1450,1490,1506,1511,1518],{"__ignoreMap":388},[339,1389,1390,1392,1394,1397,1399,1401,1405,1407,1410],{"class":394,"line":395},[339,1391,399],{"class":398},[339,1393,402],{"class":398},[339,1395,1396],{"class":405}," defineNitroPlugin",[339,1398,410],{"class":409},[339,1400,410],{"class":413},[339,1402,1404],{"class":1403},"sHdIc","nitroApp",[339,1406,1112],{"class":413},[339,1408,1409],{"class":612}," =>",[339,1411,453],{"class":413},[339,1413,1414,1417,1420,1423,1425,1428,1430,1432,1434,1436,1438,1441,1444,1446,1448],{"class":394,"line":417},[339,1415,1416],{"class":409},"  nitroApp",[339,1418,1419],{"class":413},".",[339,1421,1422],{"class":409},"hooks",[339,1424,1419],{"class":413},[339,1426,1427],{"class":405},"hook",[339,1429,410],{"class":420},[339,1431,430],{"class":413},[339,1433,1375],{"class":433},[339,1435,430],{"class":413},[339,1437,488],{"class":413},[339,1439,1440],{"class":413}," (",[339,1442,1443],{"class":1403},"ctx",[339,1445,1112],{"class":413},[339,1447,1409],{"class":612},[339,1449,453],{"class":413},[339,1451,1452,1455,1457,1459,1461,1464,1466,1469,1472,1475,1478,1480,1483,1485,1488],{"class":394,"line":445},[339,1453,1454],{"class":398},"    if",[339,1456,1440],{"class":420},[339,1458,1443],{"class":409},[339,1460,1419],{"class":413},[339,1462,1463],{"class":409},"context",[339,1465,1419],{"class":413},[339,1467,1468],{"class":409},"user",[339,1470,1471],{"class":413},"?.",[339,1473,1474],{"class":409},"plan",[339,1476,1477],{"class":413}," ===",[339,1479,593],{"class":413},[339,1481,1482],{"class":433},"enterprise",[339,1484,430],{"class":413},[339,1486,1487],{"class":420},") ",[339,1489,414],{"class":413},[339,1491,1492,1495,1497,1500,1502],{"class":394,"line":456},[339,1493,1494],{"class":409},"      ctx",[339,1496,1419],{"class":413},[339,1498,1499],{"class":409},"shouldKeep",[339,1501,628],{"class":413},[339,1503,1505],{"class":1504},"sfNiH"," true\n",[339,1507,1508],{"class":394,"line":466},[339,1509,1510],{"class":413},"    }\n",[339,1512,1513,1516],{"class":394,"line":476},[339,1514,1515],{"class":413},"  }",[339,1517,567],{"class":420},[339,1519,1520,1522],{"class":394,"line":495},[339,1521,564],{"class":413},[339,1523,567],{"class":409},[382,1525,1527],{"className":384,"code":1526,"filename":571,"language":387,"meta":388,"style":388},"import { createEvlog } from 'evlog\u002Fnext'\n\nexport const { withEvlog, useLogger } = createEvlog({\n  service: 'my-app',\n  sampling: {\n    rates: { info: 10 },\n    keep: [{ status: 400 }],\n  },\n  keep(ctx) {\n    if (ctx.context.user?.plan === 'enterprise') {\n      ctx.shouldKeep = true\n    }\n  },\n})\n",[390,1528,1529,1547,1551,1575,1589,1597,1613,1636,1640,1652,1684,1696,1700,1704],{"__ignoreMap":388},[339,1530,1531,1533,1535,1537,1539,1541,1543,1545],{"class":394,"line":395},[339,1532,578],{"class":398},[339,1534,581],{"class":413},[339,1536,584],{"class":409},[339,1538,587],{"class":413},[339,1540,590],{"class":398},[339,1542,593],{"class":413},[339,1544,596],{"class":433},[339,1546,599],{"class":413},[339,1548,1549],{"class":394,"line":417},[339,1550,605],{"emptyLinePlaceholder":604},[339,1552,1553,1555,1557,1559,1561,1563,1565,1567,1569,1571,1573],{"class":394,"line":445},[339,1554,399],{"class":398},[339,1556,613],{"class":612},[339,1558,581],{"class":413},[339,1560,618],{"class":409},[339,1562,488],{"class":413},[339,1564,623],{"class":409},[339,1566,564],{"class":413},[339,1568,628],{"class":413},[339,1570,584],{"class":405},[339,1572,410],{"class":409},[339,1574,414],{"class":413},[339,1576,1577,1579,1581,1583,1585,1587],{"class":394,"line":456},[339,1578,639],{"class":420},[339,1580,424],{"class":413},[339,1582,593],{"class":413},[339,1584,646],{"class":433},[339,1586,430],{"class":413},[339,1588,442],{"class":413},[339,1590,1591,1593,1595],{"class":394,"line":466},[339,1592,655],{"class":420},[339,1594,424],{"class":413},[339,1596,453],{"class":413},[339,1598,1599,1601,1603,1605,1607,1609,1611],{"class":394,"line":476},[339,1600,664],{"class":420},[339,1602,424],{"class":413},[339,1604,581],{"class":413},[339,1606,923],{"class":420},[339,1608,424],{"class":413},[339,1610,485],{"class":484},[339,1612,788],{"class":413},[339,1614,1615,1617,1619,1621,1624,1626,1628,1630,1632,1634],{"class":394,"line":495},[339,1616,934],{"class":420},[339,1618,424],{"class":413},[339,1620,427],{"class":409},[339,1622,1623],{"class":413},"{",[339,1625,947],{"class":420},[339,1627,424],{"class":413},[339,1629,952],{"class":484},[339,1631,587],{"class":413},[339,1633,439],{"class":409},[339,1635,442],{"class":413},[339,1637,1638],{"class":394,"line":511},[339,1639,558],{"class":413},[339,1641,1642,1644,1646,1648,1650],{"class":394,"line":527},[339,1643,1198],{"class":420},[339,1645,410],{"class":413},[339,1647,1443],{"class":1403},[339,1649,1112],{"class":413},[339,1651,453],{"class":413},[339,1653,1654,1656,1658,1660,1662,1664,1666,1668,1670,1672,1674,1676,1678,1680,1682],{"class":394,"line":543},[339,1655,1454],{"class":398},[339,1657,1440],{"class":420},[339,1659,1443],{"class":409},[339,1661,1419],{"class":413},[339,1663,1463],{"class":409},[339,1665,1419],{"class":413},[339,1667,1468],{"class":409},[339,1669,1471],{"class":413},[339,1671,1474],{"class":409},[339,1673,1477],{"class":413},[339,1675,593],{"class":413},[339,1677,1482],{"class":433},[339,1679,430],{"class":413},[339,1681,1487],{"class":420},[339,1683,414],{"class":413},[339,1685,1686,1688,1690,1692,1694],{"class":394,"line":549},[339,1687,1494],{"class":409},[339,1689,1419],{"class":413},[339,1691,1499],{"class":409},[339,1693,628],{"class":413},[339,1695,1505],{"class":1504},[339,1697,1698],{"class":394,"line":555},[339,1699,1510],{"class":413},[339,1701,1702],{"class":394,"line":561},[339,1703,558],{"class":413},[339,1705,1707,1709],{"class":394,"line":1706},14,[339,1708,564],{"class":413},[339,1710,567],{"class":409},[382,1712,1715],{"className":384,"code":1713,"filename":1714,"language":387,"meta":388,"style":388},"import { evlog } from 'evlog\u002Fhono'\n\napp.use(evlog({\n  keep(ctx) {\n    if (ctx.context.user?.plan === 'enterprise') {\n      ctx.shouldKeep = true\n    }\n  },\n}))\n","index.ts (Hono)",[390,1716,1717,1737,1741,1759,1771,1803,1815,1819,1823],{"__ignoreMap":388},[339,1718,1719,1721,1723,1726,1728,1730,1732,1735],{"class":394,"line":395},[339,1720,578],{"class":398},[339,1722,581],{"class":413},[339,1724,1725],{"class":409}," evlog",[339,1727,587],{"class":413},[339,1729,590],{"class":398},[339,1731,593],{"class":413},[339,1733,1734],{"class":433},"evlog\u002Fhono",[339,1736,599],{"class":413},[339,1738,1739],{"class":394,"line":417},[339,1740,605],{"emptyLinePlaceholder":604},[339,1742,1743,1746,1748,1751,1753,1755,1757],{"class":394,"line":445},[339,1744,1745],{"class":409},"app",[339,1747,1419],{"class":413},[339,1749,1750],{"class":405},"use",[339,1752,410],{"class":409},[339,1754,750],{"class":405},[339,1756,410],{"class":409},[339,1758,414],{"class":413},[339,1760,1761,1763,1765,1767,1769],{"class":394,"line":456},[339,1762,1198],{"class":420},[339,1764,410],{"class":413},[339,1766,1443],{"class":1403},[339,1768,1112],{"class":413},[339,1770,453],{"class":413},[339,1772,1773,1775,1777,1779,1781,1783,1785,1787,1789,1791,1793,1795,1797,1799,1801],{"class":394,"line":466},[339,1774,1454],{"class":398},[339,1776,1440],{"class":420},[339,1778,1443],{"class":409},[339,1780,1419],{"class":413},[339,1782,1463],{"class":409},[339,1784,1419],{"class":413},[339,1786,1468],{"class":409},[339,1788,1471],{"class":413},[339,1790,1474],{"class":409},[339,1792,1477],{"class":413},[339,1794,593],{"class":413},[339,1796,1482],{"class":433},[339,1798,430],{"class":413},[339,1800,1487],{"class":420},[339,1802,414],{"class":413},[339,1804,1805,1807,1809,1811,1813],{"class":394,"line":476},[339,1806,1494],{"class":409},[339,1808,1419],{"class":413},[339,1810,1499],{"class":409},[339,1812,628],{"class":413},[339,1814,1505],{"class":1504},[339,1816,1817],{"class":394,"line":495},[339,1818,1510],{"class":413},[339,1820,1821],{"class":394,"line":511},[339,1822,558],{"class":413},[339,1824,1825,1827],{"class":394,"line":527},[339,1826,564],{"class":413},[339,1828,1829],{"class":409},"))\n",[314,1831,1832,1833,1835],{},"The ",[390,1834,1443],{}," object contains:",[1042,1837,1838,1849],{},[1045,1839,1840],{},[1048,1841,1842,1845,1847],{},[1051,1843,1844],{},"Field",[1051,1846,1056],{},[1051,1848,1059],{},[1061,1850,1851,1865,1878,1892,1906,1923],{},[1048,1852,1853,1857,1862],{},[1066,1854,1855],{},[390,1856,1022],{},[1066,1858,1859],{},[390,1860,1861],{},"number | undefined",[1066,1863,1864],{},"HTTP response status",[1048,1866,1867,1871,1875],{},[1066,1868,1869],{},[390,1870,1026],{},[1066,1872,1873],{},[390,1874,1861],{},[1066,1876,1877],{},"Request duration in ms",[1048,1879,1880,1884,1889],{},[1066,1881,1882],{},[390,1883,1030],{},[1066,1885,1886],{},[390,1887,1888],{},"string | undefined",[1066,1890,1891],{},"Request path",[1048,1893,1894,1899,1903],{},[1066,1895,1896],{},[390,1897,1898],{},"method",[1066,1900,1901],{},[390,1902,1888],{},[1066,1904,1905],{},"HTTP method",[1048,1907,1908,1912,1917],{},[1066,1909,1910],{},[390,1911,1463],{},[1066,1913,1914],{},[390,1915,1916],{},"Record\u003Cstring, unknown>",[1066,1918,1919,1920],{},"All fields set via ",[390,1921,1922],{},"log.set()",[1048,1924,1925,1929,1934],{},[1066,1926,1927],{},[390,1928,1499],{},[1066,1930,1931],{},[390,1932,1933],{},"boolean",[1066,1935,1936,1937,1940],{},"Set to ",[390,1938,1939],{},"true"," to force-keep",[366,1942,1944],{"id":1943},"production-example","Production Example",[314,1946,1947],{},"A typical production configuration that balances cost and visibility:",[379,1949,1950,2205,2410],{},[382,1951,1953],{"className":384,"code":1952,"filename":386,"language":387,"meta":388,"style":388},"export default defineNuxtConfig({\n  modules: ['evlog\u002Fnuxt'],\n  evlog: {\n    env: { service: 'my-app' },\n  },\n  $production: {\n    evlog: {\n      sampling: {\n        rates: {\n          info: 10,\n          warn: 50,\n          debug: 0,\n          error: 100,\n        },\n        keep: [\n          { status: 400 },\n          { duration: 1000 },\n          { path: '\u002Fapi\u002Fpayments\u002F**' },\n          { path: '\u002Fapi\u002Fauth\u002F**' },\n        ],\n      },\n    },\n  },\n})\n",[390,1954,1955,1967,1985,1993,2014,2018,2027,2036,2045,2054,2065,2076,2087,2098,2103,2113,2127,2140,2157,2175,2183,2188,2193,2198],{"__ignoreMap":388},[339,1956,1957,1959,1961,1963,1965],{"class":394,"line":395},[339,1958,399],{"class":398},[339,1960,402],{"class":398},[339,1962,406],{"class":405},[339,1964,410],{"class":409},[339,1966,414],{"class":413},[339,1968,1969,1971,1973,1975,1977,1979,1981,1983],{"class":394,"line":417},[339,1970,421],{"class":420},[339,1972,424],{"class":413},[339,1974,427],{"class":409},[339,1976,430],{"class":413},[339,1978,434],{"class":433},[339,1980,430],{"class":413},[339,1982,439],{"class":409},[339,1984,442],{"class":413},[339,1986,1987,1989,1991],{"class":394,"line":445},[339,1988,448],{"class":420},[339,1990,424],{"class":413},[339,1992,453],{"class":413},[339,1994,1995,1998,2000,2002,2004,2006,2008,2010,2012],{"class":394,"line":456},[339,1996,1997],{"class":420},"    env",[339,1999,424],{"class":413},[339,2001,581],{"class":413},[339,2003,777],{"class":420},[339,2005,424],{"class":413},[339,2007,593],{"class":413},[339,2009,646],{"class":433},[339,2011,430],{"class":413},[339,2013,788],{"class":413},[339,2015,2016],{"class":394,"line":466},[339,2017,558],{"class":413},[339,2019,2020,2023,2025],{"class":394,"line":476},[339,2021,2022],{"class":420},"  $production",[339,2024,424],{"class":413},[339,2026,453],{"class":413},[339,2028,2029,2032,2034],{"class":394,"line":495},[339,2030,2031],{"class":420},"    evlog",[339,2033,424],{"class":413},[339,2035,453],{"class":413},[339,2037,2038,2041,2043],{"class":394,"line":511},[339,2039,2040],{"class":420},"      sampling",[339,2042,424],{"class":413},[339,2044,453],{"class":413},[339,2046,2047,2050,2052],{"class":394,"line":527},[339,2048,2049],{"class":420},"        rates",[339,2051,424],{"class":413},[339,2053,453],{"class":413},[339,2055,2056,2059,2061,2063],{"class":394,"line":543},[339,2057,2058],{"class":420},"          info",[339,2060,424],{"class":413},[339,2062,485],{"class":484},[339,2064,442],{"class":413},[339,2066,2067,2070,2072,2074],{"class":394,"line":549},[339,2068,2069],{"class":420},"          warn",[339,2071,424],{"class":413},[339,2073,503],{"class":484},[339,2075,442],{"class":413},[339,2077,2078,2081,2083,2085],{"class":394,"line":555},[339,2079,2080],{"class":420},"          debug",[339,2082,424],{"class":413},[339,2084,519],{"class":484},[339,2086,442],{"class":413},[339,2088,2089,2092,2094,2096],{"class":394,"line":561},[339,2090,2091],{"class":420},"          error",[339,2093,424],{"class":413},[339,2095,535],{"class":484},[339,2097,442],{"class":413},[339,2099,2100],{"class":394,"line":1706},[339,2101,2102],{"class":413},"        },\n",[339,2104,2106,2109,2111],{"class":394,"line":2105},15,[339,2107,2108],{"class":420},"        keep",[339,2110,424],{"class":413},[339,2112,939],{"class":409},[339,2114,2116,2119,2121,2123,2125],{"class":394,"line":2115},16,[339,2117,2118],{"class":413},"          {",[339,2120,947],{"class":420},[339,2122,424],{"class":413},[339,2124,952],{"class":484},[339,2126,788],{"class":413},[339,2128,2130,2132,2134,2136,2138],{"class":394,"line":2129},17,[339,2131,2118],{"class":413},[339,2133,965],{"class":420},[339,2135,424],{"class":413},[339,2137,970],{"class":484},[339,2139,788],{"class":413},[339,2141,2143,2145,2147,2149,2151,2153,2155],{"class":394,"line":2142},18,[339,2144,2118],{"class":413},[339,2146,982],{"class":420},[339,2148,424],{"class":413},[339,2150,593],{"class":413},[339,2152,989],{"class":433},[339,2154,430],{"class":413},[339,2156,788],{"class":413},[339,2158,2160,2162,2164,2166,2168,2171,2173],{"class":394,"line":2159},19,[339,2161,2118],{"class":413},[339,2163,982],{"class":420},[339,2165,424],{"class":413},[339,2167,593],{"class":413},[339,2169,2170],{"class":433},"\u002Fapi\u002Fauth\u002F**",[339,2172,430],{"class":413},[339,2174,788],{"class":413},[339,2176,2178,2181],{"class":394,"line":2177},20,[339,2179,2180],{"class":409},"        ]",[339,2182,442],{"class":413},[339,2184,2186],{"class":394,"line":2185},21,[339,2187,546],{"class":413},[339,2189,2191],{"class":394,"line":2190},22,[339,2192,552],{"class":413},[339,2194,2196],{"class":394,"line":2195},23,[339,2197,558],{"class":413},[339,2199,2201,2203],{"class":394,"line":2200},24,[339,2202,564],{"class":413},[339,2204,567],{"class":409},[382,2206,2208],{"className":384,"code":2207,"filename":571,"language":387,"meta":388,"style":388},"import { createEvlog } from 'evlog\u002Fnext'\n\nexport const { withEvlog, useLogger } = createEvlog({\n  service: 'my-app',\n  sampling: {\n    rates: {\n      info: 10,\n      warn: 50,\n      debug: 0,\n      error: 100,\n    },\n    keep: [\n      { status: 400 },\n      { duration: 1000 },\n      { path: '\u002Fapi\u002Fpayments\u002F**' },\n      { path: '\u002Fapi\u002Fauth\u002F**' },\n    ],\n  },\n})\n",[390,2209,2210,2228,2232,2256,2270,2278,2286,2296,2306,2316,2326,2330,2338,2350,2362,2378,2394,2400,2404],{"__ignoreMap":388},[339,2211,2212,2214,2216,2218,2220,2222,2224,2226],{"class":394,"line":395},[339,2213,578],{"class":398},[339,2215,581],{"class":413},[339,2217,584],{"class":409},[339,2219,587],{"class":413},[339,2221,590],{"class":398},[339,2223,593],{"class":413},[339,2225,596],{"class":433},[339,2227,599],{"class":413},[339,2229,2230],{"class":394,"line":417},[339,2231,605],{"emptyLinePlaceholder":604},[339,2233,2234,2236,2238,2240,2242,2244,2246,2248,2250,2252,2254],{"class":394,"line":445},[339,2235,399],{"class":398},[339,2237,613],{"class":612},[339,2239,581],{"class":413},[339,2241,618],{"class":409},[339,2243,488],{"class":413},[339,2245,623],{"class":409},[339,2247,564],{"class":413},[339,2249,628],{"class":413},[339,2251,584],{"class":405},[339,2253,410],{"class":409},[339,2255,414],{"class":413},[339,2257,2258,2260,2262,2264,2266,2268],{"class":394,"line":456},[339,2259,639],{"class":420},[339,2261,424],{"class":413},[339,2263,593],{"class":413},[339,2265,646],{"class":433},[339,2267,430],{"class":413},[339,2269,442],{"class":413},[339,2271,2272,2274,2276],{"class":394,"line":466},[339,2273,655],{"class":420},[339,2275,424],{"class":413},[339,2277,453],{"class":413},[339,2279,2280,2282,2284],{"class":394,"line":476},[339,2281,664],{"class":420},[339,2283,424],{"class":413},[339,2285,453],{"class":413},[339,2287,2288,2290,2292,2294],{"class":394,"line":495},[339,2289,673],{"class":420},[339,2291,424],{"class":413},[339,2293,485],{"class":484},[339,2295,442],{"class":413},[339,2297,2298,2300,2302,2304],{"class":394,"line":511},[339,2299,684],{"class":420},[339,2301,424],{"class":413},[339,2303,503],{"class":484},[339,2305,442],{"class":413},[339,2307,2308,2310,2312,2314],{"class":394,"line":527},[339,2309,695],{"class":420},[339,2311,424],{"class":413},[339,2313,519],{"class":484},[339,2315,442],{"class":413},[339,2317,2318,2320,2322,2324],{"class":394,"line":543},[339,2319,706],{"class":420},[339,2321,424],{"class":413},[339,2323,535],{"class":484},[339,2325,442],{"class":413},[339,2327,2328],{"class":394,"line":549},[339,2329,552],{"class":413},[339,2331,2332,2334,2336],{"class":394,"line":555},[339,2333,934],{"class":420},[339,2335,424],{"class":413},[339,2337,939],{"class":409},[339,2339,2340,2342,2344,2346,2348],{"class":394,"line":561},[339,2341,944],{"class":413},[339,2343,947],{"class":420},[339,2345,424],{"class":413},[339,2347,952],{"class":484},[339,2349,788],{"class":413},[339,2351,2352,2354,2356,2358,2360],{"class":394,"line":1706},[339,2353,944],{"class":413},[339,2355,965],{"class":420},[339,2357,424],{"class":413},[339,2359,970],{"class":484},[339,2361,788],{"class":413},[339,2363,2364,2366,2368,2370,2372,2374,2376],{"class":394,"line":2105},[339,2365,944],{"class":413},[339,2367,982],{"class":420},[339,2369,424],{"class":413},[339,2371,593],{"class":413},[339,2373,989],{"class":433},[339,2375,430],{"class":413},[339,2377,788],{"class":413},[339,2379,2380,2382,2384,2386,2388,2390,2392],{"class":394,"line":2115},[339,2381,944],{"class":413},[339,2383,982],{"class":420},[339,2385,424],{"class":413},[339,2387,593],{"class":413},[339,2389,2170],{"class":433},[339,2391,430],{"class":413},[339,2393,788],{"class":413},[339,2395,2396,2398],{"class":394,"line":2129},[339,2397,1001],{"class":409},[339,2399,442],{"class":413},[339,2401,2402],{"class":394,"line":2142},[339,2403,558],{"class":413},[339,2405,2406,2408],{"class":394,"line":2159},[339,2407,564],{"class":413},[339,2409,567],{"class":409},[382,2411,2413],{"className":384,"code":2412,"filename":730,"language":387,"meta":388,"style":388},"import { initLogger } from 'evlog'\n\ninitLogger({\n  env: { service: 'my-app' },\n  sampling: {\n    rates: {\n      info: 10,\n      warn: 50,\n      debug: 0,\n      error: 100,\n    },\n    keep: [\n      { status: 400 },\n      { duration: 1000 },\n      { path: '\u002Fapi\u002Fpayments\u002F**' },\n      { path: '\u002Fapi\u002Fauth\u002F**' },\n    ],\n  },\n})\n",[390,2414,2415,2433,2437,2445,2465,2473,2481,2491,2501,2511,2521,2525,2533,2545,2557,2573,2589,2595,2599],{"__ignoreMap":388},[339,2416,2417,2419,2421,2423,2425,2427,2429,2431],{"class":394,"line":395},[339,2418,578],{"class":398},[339,2420,581],{"class":413},[339,2422,741],{"class":409},[339,2424,587],{"class":413},[339,2426,590],{"class":398},[339,2428,593],{"class":413},[339,2430,750],{"class":433},[339,2432,599],{"class":413},[339,2434,2435],{"class":394,"line":417},[339,2436,605],{"emptyLinePlaceholder":604},[339,2438,2439,2441,2443],{"class":394,"line":445},[339,2440,761],{"class":405},[339,2442,410],{"class":409},[339,2444,414],{"class":413},[339,2446,2447,2449,2451,2453,2455,2457,2459,2461,2463],{"class":394,"line":456},[339,2448,770],{"class":420},[339,2450,424],{"class":413},[339,2452,581],{"class":413},[339,2454,777],{"class":420},[339,2456,424],{"class":413},[339,2458,593],{"class":413},[339,2460,646],{"class":433},[339,2462,430],{"class":413},[339,2464,788],{"class":413},[339,2466,2467,2469,2471],{"class":394,"line":466},[339,2468,655],{"class":420},[339,2470,424],{"class":413},[339,2472,453],{"class":413},[339,2474,2475,2477,2479],{"class":394,"line":476},[339,2476,664],{"class":420},[339,2478,424],{"class":413},[339,2480,453],{"class":413},[339,2482,2483,2485,2487,2489],{"class":394,"line":495},[339,2484,673],{"class":420},[339,2486,424],{"class":413},[339,2488,485],{"class":484},[339,2490,442],{"class":413},[339,2492,2493,2495,2497,2499],{"class":394,"line":511},[339,2494,684],{"class":420},[339,2496,424],{"class":413},[339,2498,503],{"class":484},[339,2500,442],{"class":413},[339,2502,2503,2505,2507,2509],{"class":394,"line":527},[339,2504,695],{"class":420},[339,2506,424],{"class":413},[339,2508,519],{"class":484},[339,2510,442],{"class":413},[339,2512,2513,2515,2517,2519],{"class":394,"line":543},[339,2514,706],{"class":420},[339,2516,424],{"class":413},[339,2518,535],{"class":484},[339,2520,442],{"class":413},[339,2522,2523],{"class":394,"line":549},[339,2524,552],{"class":413},[339,2526,2527,2529,2531],{"class":394,"line":555},[339,2528,934],{"class":420},[339,2530,424],{"class":413},[339,2532,939],{"class":409},[339,2534,2535,2537,2539,2541,2543],{"class":394,"line":561},[339,2536,944],{"class":413},[339,2538,947],{"class":420},[339,2540,424],{"class":413},[339,2542,952],{"class":484},[339,2544,788],{"class":413},[339,2546,2547,2549,2551,2553,2555],{"class":394,"line":1706},[339,2548,944],{"class":413},[339,2550,965],{"class":420},[339,2552,424],{"class":413},[339,2554,970],{"class":484},[339,2556,788],{"class":413},[339,2558,2559,2561,2563,2565,2567,2569,2571],{"class":394,"line":2105},[339,2560,944],{"class":413},[339,2562,982],{"class":420},[339,2564,424],{"class":413},[339,2566,593],{"class":413},[339,2568,989],{"class":433},[339,2570,430],{"class":413},[339,2572,788],{"class":413},[339,2574,2575,2577,2579,2581,2583,2585,2587],{"class":394,"line":2115},[339,2576,944],{"class":413},[339,2578,982],{"class":420},[339,2580,424],{"class":413},[339,2582,593],{"class":413},[339,2584,2170],{"class":433},[339,2586,430],{"class":413},[339,2588,788],{"class":413},[339,2590,2591,2593],{"class":394,"line":2129},[339,2592,1001],{"class":409},[339,2594,442],{"class":413},[339,2596,2597],{"class":394,"line":2142},[339,2598,558],{"class":413},[339,2600,2601,2603],{"class":394,"line":2159},[339,2602,564],{"class":413},[339,2604,567],{"class":409},[867,2606,2609,2610,2613],{"color":2607,"icon":2608},"warning","i-lucide-lightbulb","In Nuxt, use the ",[390,2611,2612],{},"$production"," override to keep full logging in development while sampling in production. In other frameworks, use your own environment check or config system.",[366,2615,2617],{"id":2616},"next-steps","Next Steps",[326,2619,2620,2625],{},[329,2621,2622,2624],{},[355,2623,106],{"href":107}," - Security and production checklist",[329,2626,2627,2629],{},[355,2628,51],{"href":52}," - Design effective wide events",[2631,2632,2633],"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 .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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 .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 .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 .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}",{"title":388,"searchDepth":417,"depth":417,"links":2635},[2636,2637,2640,2641,2642,2643],{"id":368,"depth":417,"text":369},{"id":877,"depth":417,"text":878,"children":2638},[2639],{"id":1039,"depth":445,"text":1040},{"id":1115,"depth":417,"text":1116},{"id":1368,"depth":417,"text":1369},{"id":1943,"depth":417,"text":1944},{"id":2616,"depth":417,"text":2617},"Control log volume with two-tier sampling. Head sampling drops noise by level, tail sampling rescues critical events based on outcome. Never miss errors, slow requests, or critical paths.","md",[2647,2650],{"label":106,"icon":79,"to":107,"color":2648,"variant":2649},"neutral","subtle",{"label":51,"icon":54,"to":52,"color":2648,"variant":2649},{},{"icon":99},{"title":96,"description":2644},"s5x9L5LAkAlpDFEUjifcnbSDuuGjyV3i-DGzkQ-6Z2Y",[2656,2658],{"title":91,"path":92,"stem":93,"description":2657,"icon":94,"children":-1},"Complete reference for all evlog configuration options including global logger settings, middleware options, environment context, and framework-specific overrides.",{"title":101,"path":102,"stem":103,"description":2659,"icon":104,"children":-1},"Add compile-time type safety to your wide events with TypeScript module augmentation. Prevent typos and ensure consistent field names across your codebase.",1777667163419]