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