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