[{"data":1,"prerenderedAt":1724},["ShallowReactive",2],{"navigation_docs":3,"-logging-ai-sdk-telemetry":421,"-logging-ai-sdk-telemetry-surround":1719},[4,35,159,201,289,318,405],{"title":5,"path":6,"stem":7,"children":8,"page":34},"Getting Started","\u002Fgetting-started","1.getting-started",[9,14,19,24,29],{"title":10,"path":11,"stem":12,"icon":13},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction","i-lucide-info",{"title":15,"path":16,"stem":17,"icon":18},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation","i-lucide-download",{"title":20,"path":21,"stem":22,"icon":23},"Quick Start","\u002Fgetting-started\u002Fquick-start","1.getting-started\u002F3.quick-start","i-lucide-zap",{"title":25,"path":26,"stem":27,"icon":28},"Agent Skills","\u002Fgetting-started\u002Fagent-skills","1.getting-started\u002F4.agent-skills","i-lucide-sparkles",{"title":30,"path":31,"stem":32,"icon":33},"vs Other Loggers","\u002Fgetting-started\u002Fvs-other-loggers","1.getting-started\u002F5.vs-other-loggers","i-lucide-scale",false,{"title":36,"path":37,"stem":38,"children":39,"page":34},"Logging","\u002Flogging","2.logging",[40,45,50,55,60,65,70,99,127],{"title":41,"path":42,"stem":43,"icon":44},"Overview","\u002Flogging\u002Foverview","2.logging\u002F0.overview","i-lucide-list",{"title":46,"path":47,"stem":48,"icon":49},"Simple Logging","\u002Flogging\u002Fsimple-logging","2.logging\u002F1.simple-logging","i-lucide-terminal",{"title":51,"path":52,"stem":53,"icon":54},"Wide Events","\u002Flogging\u002Fwide-events","2.logging\u002F2.wide-events","i-lucide-layers",{"title":56,"path":57,"stem":58,"icon":59},"Structured Errors","\u002Flogging\u002Fstructured-errors","2.logging\u002F3.structured-errors","i-lucide-shield-alert",{"title":61,"path":62,"stem":63,"icon":64},"Catalogs","\u002Flogging\u002Fcatalogs","2.logging\u002F4.catalogs","i-lucide-book-open",{"title":66,"path":67,"stem":68,"icon":69},"Client Logging","\u002Flogging\u002Fclient-logging","2.logging\u002F5.client-logging","i-lucide-monitor",{"title":71,"icon":72,"path":73,"stem":74,"children":75,"page":34},"AI SDK","i-simple-icons-vercel","\u002Flogging\u002Fai-sdk","2.logging\u002F6.ai-sdk",[76,79,84,89,94],{"title":41,"path":77,"stem":78,"icon":44},"\u002Flogging\u002Fai-sdk\u002Foverview","2.logging\u002F6.ai-sdk\u002F01.overview",{"title":80,"path":81,"stem":82,"icon":83},"Usage","\u002Flogging\u002Fai-sdk\u002Fusage","2.logging\u002F6.ai-sdk\u002F02.usage","i-lucide-code",{"title":85,"path":86,"stem":87,"icon":88},"Options","\u002Flogging\u002Fai-sdk\u002Foptions","2.logging\u002F6.ai-sdk\u002F03.options","i-lucide-sliders",{"title":90,"path":91,"stem":92,"icon":93},"Metadata","\u002Flogging\u002Fai-sdk\u002Fmetadata","2.logging\u002F6.ai-sdk\u002F04.metadata","i-lucide-database",{"title":95,"path":96,"stem":97,"icon":98},"Telemetry","\u002Flogging\u002Fai-sdk\u002Ftelemetry","2.logging\u002F6.ai-sdk\u002F05.telemetry","i-lucide-activity",{"title":100,"icon":101,"path":102,"stem":103,"children":104,"page":34},"Better Auth","i-simple-icons-betterauth","\u002Flogging\u002Fbetter-auth","2.logging\u002F7.better-auth",[105,108,113,118,122],{"title":41,"path":106,"stem":107,"icon":44},"\u002Flogging\u002Fbetter-auth\u002Foverview","2.logging\u002F7.better-auth\u002F01.overview",{"title":109,"path":110,"stem":111,"icon":112},"Identify User","\u002Flogging\u002Fbetter-auth\u002Fidentify-user","2.logging\u002F7.better-auth\u002F02.identify-user","i-lucide-user-check",{"title":114,"path":115,"stem":116,"icon":117},"Middleware","\u002Flogging\u002Fbetter-auth\u002Fmiddleware","2.logging\u002F7.better-auth\u002F03.middleware","i-lucide-shield",{"title":119,"path":120,"stem":121,"icon":69},"Client Sync","\u002Flogging\u002Fbetter-auth\u002Fclient-sync","2.logging\u002F7.better-auth\u002F04.client-sync",{"title":123,"path":124,"stem":125,"icon":126},"Performance","\u002Flogging\u002Fbetter-auth\u002Fperformance","2.logging\u002F7.better-auth\u002F05.performance","i-lucide-gauge",{"title":128,"icon":129,"path":130,"stem":131,"children":132,"page":34},"Audit Logs","i-lucide-shield-check","\u002Flogging\u002Faudit","2.logging\u002F8.audit",[133,136,141,146,151,155],{"title":41,"path":134,"stem":135,"icon":44},"\u002Flogging\u002Faudit\u002Foverview","2.logging\u002F8.audit\u002F01.overview",{"title":137,"path":138,"stem":139,"icon":140},"Schema","\u002Flogging\u002Faudit\u002Fschema","2.logging\u002F8.audit\u002F02.schema","i-lucide-file-text",{"title":142,"path":143,"stem":144,"icon":145},"Recording","\u002Flogging\u002Faudit\u002Frecording","2.logging\u002F8.audit\u002F03.recording","i-lucide-pen-line",{"title":147,"path":148,"stem":149,"icon":150},"Drains","\u002Flogging\u002Faudit\u002Fpipeline","2.logging\u002F8.audit\u002F04.pipeline","i-lucide-link",{"title":152,"path":153,"stem":154,"icon":129},"Compliance","\u002Flogging\u002Faudit\u002Fcompliance","2.logging\u002F8.audit\u002F05.compliance",{"title":156,"path":157,"stem":158,"icon":64},"Recipes","\u002Flogging\u002Faudit\u002Frecipes","2.logging\u002F8.audit\u002F06.recipes",{"title":160,"path":161,"stem":162,"children":163,"page":34},"Core Concepts","\u002Fcore-concepts","3.core-concepts",[164,169,174,179,184,188,191,196],{"title":165,"path":166,"stem":167,"icon":168},"Lifecycle","\u002Fcore-concepts\u002Flifecycle","3.core-concepts\u002F0.lifecycle","i-lucide-arrow-right-left",{"title":170,"path":171,"stem":172,"icon":173},"Configuration","\u002Fcore-concepts\u002Fconfiguration","3.core-concepts\u002F1.configuration","i-lucide-settings",{"title":175,"path":176,"stem":177,"icon":178},"Sampling","\u002Fcore-concepts\u002Fsampling","3.core-concepts\u002F2.sampling","i-lucide-filter",{"title":180,"path":181,"stem":182,"icon":183},"Typed Fields","\u002Fcore-concepts\u002Ftyped-fields","3.core-concepts\u002F3.typed-fields","i-simple-icons-typescript",{"title":185,"path":186,"stem":187,"icon":129},"Best Practices","\u002Fcore-concepts\u002Fbest-practices","3.core-concepts\u002F4.best-practices",{"title":123,"path":189,"stem":190,"icon":126},"\u002Fcore-concepts\u002Fperformance","3.core-concepts\u002F5.performance",{"title":192,"path":193,"stem":194,"icon":195},"Vite Plugin","\u002Fcore-concepts\u002Fvite-plugin","3.core-concepts\u002F6.vite-plugin","i-custom-vite",{"title":197,"path":198,"stem":199,"icon":200},"Auto-Redaction","\u002Fcore-concepts\u002Fredaction","3.core-concepts\u002F7.redaction","i-lucide-eye-off",{"title":202,"path":203,"stem":204,"children":205,"page":34},"Frameworks","\u002Fframeworks","4.frameworks",[206,210,215,220,225,230,235,240,245,250,255,260,265,270,274,279,284],{"title":41,"path":207,"stem":208,"icon":209},"\u002Fframeworks\u002Foverview","4.frameworks\u002F00.overview","i-lucide-layout-grid",{"title":211,"path":212,"stem":213,"icon":214},"Nuxt","\u002Fframeworks\u002Fnuxt","4.frameworks\u002F01.nuxt","i-simple-icons-nuxtdotjs",{"title":216,"path":217,"stem":218,"icon":219},"Next.js","\u002Fframeworks\u002Fnextjs","4.frameworks\u002F02.nextjs","i-simple-icons-nextdotjs",{"title":221,"path":222,"stem":223,"icon":224},"SvelteKit","\u002Fframeworks\u002Fsveltekit","4.frameworks\u002F03.sveltekit","i-simple-icons-svelte",{"title":226,"path":227,"stem":228,"icon":229},"Nitro","\u002Fframeworks\u002Fnitro","4.frameworks\u002F04.nitro","i-custom-nitro",{"title":231,"path":232,"stem":233,"icon":234},"TanStack Start","\u002Fframeworks\u002Ftanstack-start","4.frameworks\u002F05.tanstack-start","i-custom-tanstack",{"title":236,"path":237,"stem":238,"icon":239},"NestJS","\u002Fframeworks\u002Fnestjs","4.frameworks\u002F06.nestjs","i-simple-icons-nestjs",{"title":241,"path":242,"stem":243,"icon":244},"Express","\u002Fframeworks\u002Fexpress","4.frameworks\u002F07.express","i-simple-icons-express",{"title":246,"path":247,"stem":248,"icon":249},"Hono","\u002Fframeworks\u002Fhono","4.frameworks\u002F08.hono","i-simple-icons-hono",{"title":251,"path":252,"stem":253,"icon":254},"Fastify","\u002Fframeworks\u002Ffastify","4.frameworks\u002F09.fastify","i-simple-icons-fastify",{"title":256,"path":257,"stem":258,"icon":259},"Elysia","\u002Fframeworks\u002Felysia","4.frameworks\u002F10.elysia","i-custom-elysia",{"title":261,"path":262,"stem":263,"icon":264},"React Router","\u002Fframeworks\u002Freact-router","4.frameworks\u002F11.react-router","i-custom-reactrouter",{"title":266,"path":267,"stem":268,"icon":269},"Cloudflare Workers","\u002Fframeworks\u002Fcloudflare-workers","4.frameworks\u002F12.cloudflare-workers","i-simple-icons-cloudflare",{"title":271,"path":272,"stem":273,"icon":183},"Standalone","\u002Fframeworks\u002Fstandalone","4.frameworks\u002F13.standalone",{"title":275,"path":276,"stem":277,"icon":278},"Astro","\u002Fframeworks\u002Fastro","4.frameworks\u002F14.astro","i-simple-icons-astro",{"title":280,"path":281,"stem":282,"icon":283},"AWS Lambda","\u002Fframeworks\u002Faws-lambda","4.frameworks\u002F16.aws-lambda","i-custom-lambda",{"title":285,"path":286,"stem":287,"icon":288},"Custom Integration","\u002Fframeworks\u002Fcustom-integration","4.frameworks\u002F17.custom-integration","i-lucide-puzzle",{"title":290,"path":291,"stem":292,"children":293,"page":34},"Build on top","\u002Fbuild-on-top","5.build-on-top",[294,299,304,309,314],{"title":295,"path":296,"stem":297,"icon":298},"Identity headers","\u002Fbuild-on-top\u002Fidentity-headers","5.build-on-top\u002F1.identity-headers","i-lucide-fingerprint",{"title":300,"path":301,"stem":302,"icon":303},"Stream API","\u002Fbuild-on-top\u002Fstream-api","5.build-on-top\u002F2.stream-api","i-lucide-radio-tower",{"title":305,"path":306,"stem":307,"icon":308},"SSE bridge","\u002Fbuild-on-top\u002Fsse-bridge","5.build-on-top\u002F3.sse-bridge","i-lucide-wifi",{"title":310,"path":311,"stem":312,"icon":313},"FS reader","\u002Fbuild-on-top\u002Ffs-reader","5.build-on-top\u002F4.fs-reader","i-lucide-folder-search",{"title":156,"path":315,"stem":316,"icon":317},"\u002Fbuild-on-top\u002Frecipes","5.build-on-top\u002F4.recipes","i-lucide-chef-hat",{"title":319,"path":320,"stem":321,"children":322,"page":34},"Adapters","\u002Fadapters","6.adapters",[323,326,366,381],{"title":41,"path":324,"stem":325,"icon":44},"\u002Fadapters\u002Foverview","6.adapters\u002F01.overview",{"title":327,"path":328,"stem":329,"children":330,"page":34},"Cloud destinations","\u002Fadapters\u002Fcloud","6.adapters\u002F02.cloud",[331,336,341,346,351,356,361],{"title":332,"path":333,"stem":334,"icon":335},"Axiom","\u002Fadapters\u002Fcloud\u002Faxiom","6.adapters\u002F02.cloud\u002F01.axiom","i-custom-axiom",{"title":337,"path":338,"stem":339,"icon":340},"OTLP","\u002Fadapters\u002Fcloud\u002Fotlp","6.adapters\u002F02.cloud\u002F02.otlp","i-simple-icons-opentelemetry",{"title":342,"path":343,"stem":344,"icon":345},"PostHog","\u002Fadapters\u002Fcloud\u002Fposthog","6.adapters\u002F02.cloud\u002F03.posthog","i-simple-icons-posthog",{"title":347,"path":348,"stem":349,"icon":350},"Sentry","\u002Fadapters\u002Fcloud\u002Fsentry","6.adapters\u002F02.cloud\u002F04.sentry","i-simple-icons-sentry",{"title":352,"path":353,"stem":354,"icon":355},"Better Stack","\u002Fadapters\u002Fcloud\u002Fbetter-stack","6.adapters\u002F02.cloud\u002F05.better-stack","i-simple-icons-betterstack",{"title":357,"path":358,"stem":359,"icon":360},"Datadog","\u002Fadapters\u002Fcloud\u002Fdatadog","6.adapters\u002F02.cloud\u002F06.datadog","i-simple-icons-datadog",{"title":362,"path":363,"stem":364,"icon":365},"HyperDX","\u002Fadapters\u002Fcloud\u002Fhyperdx","6.adapters\u002F02.cloud\u002F07.hyperdx","i-custom-hyperdx",{"title":367,"path":368,"stem":369,"children":370,"page":34},"Self-hosted","\u002Fadapters\u002Fself-hosted","6.adapters\u002F03.self-hosted",[371,376],{"title":372,"path":373,"stem":374,"icon":375},"File System","\u002Fadapters\u002Fself-hosted\u002Ffs","6.adapters\u002F03.self-hosted\u002F01.fs","i-lucide-hard-drive",{"title":377,"path":378,"stem":379,"icon":380},"NuxtHub","\u002Fadapters\u002Fself-hosted\u002Fnuxthub","6.adapters\u002F03.self-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":382,"path":383,"stem":384,"children":385,"page":34},"Building blocks","\u002Fadapters\u002Fbuilding-blocks","6.adapters\u002F04.building-blocks",[386,391,396,400],{"title":387,"path":388,"stem":389,"icon":390},"Pipeline","\u002Fadapters\u002Fbuilding-blocks\u002Fpipeline","6.adapters\u002F04.building-blocks\u002F01.pipeline","i-lucide-workflow",{"title":392,"path":393,"stem":394,"icon":395},"HTTP","\u002Fadapters\u002Fbuilding-blocks\u002Fhttp","6.adapters\u002F04.building-blocks\u002F02.http","i-lucide-globe",{"title":397,"path":398,"stem":399,"icon":83},"Custom Adapters","\u002Fadapters\u002Fbuilding-blocks\u002Fcustom","6.adapters\u002F04.building-blocks\u002F03.custom",{"title":401,"path":402,"stem":403,"icon":404},"Toolkit","\u002Fadapters\u002Fbuilding-blocks\u002Ftoolkit","6.adapters\u002F04.building-blocks\u002F04.toolkit","i-lucide-blocks",{"title":406,"path":407,"stem":408,"children":409,"page":34},"Enrichers","\u002Fenrichers","7.enrichers",[410,413,417],{"title":41,"path":411,"stem":412,"icon":28},"\u002Fenrichers\u002Foverview","7.enrichers\u002F1.overview",{"title":414,"path":415,"stem":416,"icon":288},"Built-in","\u002Fenrichers\u002Fbuilt-in","7.enrichers\u002F2.built-in",{"title":418,"path":419,"stem":420,"icon":83},"Custom","\u002Fenrichers\u002Fcustom","7.enrichers\u002F3.custom",{"id":422,"title":423,"body":424,"description":1707,"extension":1708,"links":1709,"meta":1715,"navigation":1716,"path":96,"seo":1717,"stem":97,"__hash__":1718},"docs\u002F2.logging\u002F6.ai-sdk\u002F05.telemetry.md","Deeper Telemetry",{"type":425,"value":426,"toc":1701},"minimark",[427,443,448,459,789,792,1160,1164,1167,1287,1291,1360,1363,1367,1375,1552,1562,1676,1697],[428,429,430,434,435,438,439,442],"p",{},[431,432,433],"code",{},"createAILogger"," covers tokens, model info, and streaming metrics. For deeper observability — per-tool execution timing, success\u002Ffailure tracking, and total generation wall time — add ",[431,436,437],{},"createEvlogIntegration()"," on top. It implements the AI SDK's ",[431,440,441],{},"TelemetryIntegration"," interface and captures data middleware alone cannot see.",[444,445,447],"h2",{"id":446},"combined-with-middleware-recommended","Combined with middleware (recommended)",[428,449,450,451,454,455,458],{},"When passed an ",[431,452,453],{},"AILogger",", the integration shares its accumulator. Both paths write to the same ",[431,456,457],{},"ai.*"," field:",[460,461,467],"pre",{"className":462,"code":463,"filename":464,"language":465,"meta":466,"style":466},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { generateText } from 'ai'\nimport { createAILogger, createEvlogIntegration } from 'evlog\u002Fai'\n\nexport default defineEventHandler(async (event) => {\n  const log = useLogger(event)\n  const ai = createAILogger(log)\n\n  const result = await generateText({\n    model: ai.wrap('anthropic\u002Fclaude-sonnet-4.6'),\n    tools: { getWeather, searchDB },\n    experimental_telemetry: {\n      isEnabled: true,\n      integrations: [createEvlogIntegration(ai)],\n    },\n  })\n\n  return { text: result.text }\n})\n","server\u002Fapi\u002Fagent.post.ts","typescript","",[431,468,469,502,529,536,572,595,614,619,639,671,692,702,716,739,745,753,758,781],{"__ignoreMap":466},[470,471,474,478,482,486,489,492,495,499],"span",{"class":472,"line":473},"line",1,[470,475,477],{"class":476},"s7zQu","import",[470,479,481],{"class":480},"sMK4o"," {",[470,483,485],{"class":484},"sTEyZ"," generateText",[470,487,488],{"class":480}," }",[470,490,491],{"class":476}," from",[470,493,494],{"class":480}," '",[470,496,498],{"class":497},"sfazB","ai",[470,500,501],{"class":480},"'\n",[470,503,505,507,509,512,515,518,520,522,524,527],{"class":472,"line":504},2,[470,506,477],{"class":476},[470,508,481],{"class":480},[470,510,511],{"class":484}," createAILogger",[470,513,514],{"class":480},",",[470,516,517],{"class":484}," createEvlogIntegration",[470,519,488],{"class":480},[470,521,491],{"class":476},[470,523,494],{"class":480},[470,525,526],{"class":497},"evlog\u002Fai",[470,528,501],{"class":480},[470,530,532],{"class":472,"line":531},3,[470,533,535],{"emptyLinePlaceholder":534},true,"\n",[470,537,539,542,545,549,552,556,559,563,566,569],{"class":472,"line":538},4,[470,540,541],{"class":476},"export",[470,543,544],{"class":476}," default",[470,546,548],{"class":547},"s2Zo4"," defineEventHandler",[470,550,551],{"class":484},"(",[470,553,555],{"class":554},"spNyl","async",[470,557,558],{"class":480}," (",[470,560,562],{"class":561},"sHdIc","event",[470,564,565],{"class":480},")",[470,567,568],{"class":554}," =>",[470,570,571],{"class":480}," {\n",[470,573,575,578,581,584,587,590,592],{"class":472,"line":574},5,[470,576,577],{"class":554},"  const",[470,579,580],{"class":484}," log",[470,582,583],{"class":480}," =",[470,585,586],{"class":547}," useLogger",[470,588,551],{"class":589},"swJcz",[470,591,562],{"class":484},[470,593,594],{"class":589},")\n",[470,596,598,600,603,605,607,609,612],{"class":472,"line":597},6,[470,599,577],{"class":554},[470,601,602],{"class":484}," ai",[470,604,583],{"class":480},[470,606,511],{"class":547},[470,608,551],{"class":589},[470,610,611],{"class":484},"log",[470,613,594],{"class":589},[470,615,617],{"class":472,"line":616},7,[470,618,535],{"emptyLinePlaceholder":534},[470,620,622,624,627,629,632,634,636],{"class":472,"line":621},8,[470,623,577],{"class":554},[470,625,626],{"class":484}," result",[470,628,583],{"class":480},[470,630,631],{"class":476}," await",[470,633,485],{"class":547},[470,635,551],{"class":589},[470,637,638],{"class":480},"{\n",[470,640,642,645,648,650,653,656,658,661,664,666,668],{"class":472,"line":641},9,[470,643,644],{"class":589},"    model",[470,646,647],{"class":480},":",[470,649,602],{"class":484},[470,651,652],{"class":480},".",[470,654,655],{"class":547},"wrap",[470,657,551],{"class":589},[470,659,660],{"class":480},"'",[470,662,663],{"class":497},"anthropic\u002Fclaude-sonnet-4.6",[470,665,660],{"class":480},[470,667,565],{"class":589},[470,669,670],{"class":480},",\n",[470,672,674,677,679,681,684,686,689],{"class":472,"line":673},10,[470,675,676],{"class":589},"    tools",[470,678,647],{"class":480},[470,680,481],{"class":480},[470,682,683],{"class":484}," getWeather",[470,685,514],{"class":480},[470,687,688],{"class":484}," searchDB",[470,690,691],{"class":480}," },\n",[470,693,695,698,700],{"class":472,"line":694},11,[470,696,697],{"class":589},"    experimental_telemetry",[470,699,647],{"class":480},[470,701,571],{"class":480},[470,703,705,708,710,714],{"class":472,"line":704},12,[470,706,707],{"class":589},"      isEnabled",[470,709,647],{"class":480},[470,711,713],{"class":712},"sfNiH"," true",[470,715,670],{"class":480},[470,717,719,722,724,727,730,732,734,737],{"class":472,"line":718},13,[470,720,721],{"class":589},"      integrations",[470,723,647],{"class":480},[470,725,726],{"class":589}," [",[470,728,729],{"class":547},"createEvlogIntegration",[470,731,551],{"class":589},[470,733,498],{"class":484},[470,735,736],{"class":589},")]",[470,738,670],{"class":480},[470,740,742],{"class":472,"line":741},14,[470,743,744],{"class":480},"    },\n",[470,746,748,751],{"class":472,"line":747},15,[470,749,750],{"class":480},"  }",[470,752,594],{"class":589},[470,754,756],{"class":472,"line":755},16,[470,757,535],{"emptyLinePlaceholder":534},[470,759,761,764,766,769,771,773,775,778],{"class":472,"line":760},17,[470,762,763],{"class":476},"  return",[470,765,481],{"class":480},[470,767,768],{"class":589}," text",[470,770,647],{"class":480},[470,772,626],{"class":484},[470,774,652],{"class":480},[470,776,777],{"class":484},"text",[470,779,780],{"class":480}," }\n",[470,782,784,787],{"class":472,"line":783},18,[470,785,786],{"class":480},"}",[470,788,594],{"class":484},[428,790,791],{},"Your wide event now includes per-tool timing:",[460,793,798],{"className":794,"code":795,"filename":796,"language":797,"meta":466,"style":466},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"ai\": {\n    \"calls\": 2,\n    \"steps\": 2,\n    \"model\": \"claude-sonnet-4.6\",\n    \"provider\": \"anthropic\",\n    \"inputTokens\": 3500,\n    \"outputTokens\": 800,\n    \"totalTokens\": 4300,\n    \"toolCalls\": [\"getWeather\", \"searchDB\"],\n    \"tools\": [\n      { \"name\": \"getWeather\", \"durationMs\": 150, \"success\": true },\n      { \"name\": \"searchDB\", \"durationMs\": 45, \"success\": true }\n    ],\n    \"totalDurationMs\": 2340,\n    \"msToFirstChunk\": 180,\n    \"msToFinish\": 2100,\n    \"tokensPerSecond\": 380\n  }\n}\n","Wide Event","json",[431,799,800,804,818,837,852,873,893,909,925,941,973,987,1036,1081,1086,1102,1118,1134,1148,1154],{"__ignoreMap":466},[470,801,802],{"class":472,"line":473},[470,803,638],{"class":480},[470,805,806,809,811,814,816],{"class":472,"line":504},[470,807,808],{"class":480},"  \"",[470,810,498],{"class":554},[470,812,813],{"class":480},"\"",[470,815,647],{"class":480},[470,817,571],{"class":480},[470,819,820,823,827,829,831,835],{"class":472,"line":531},[470,821,822],{"class":480},"    \"",[470,824,826],{"class":825},"sBMFI","calls",[470,828,813],{"class":480},[470,830,647],{"class":480},[470,832,834],{"class":833},"sbssI"," 2",[470,836,670],{"class":480},[470,838,839,841,844,846,848,850],{"class":472,"line":538},[470,840,822],{"class":480},[470,842,843],{"class":825},"steps",[470,845,813],{"class":480},[470,847,647],{"class":480},[470,849,834],{"class":833},[470,851,670],{"class":480},[470,853,854,856,859,861,863,866,869,871],{"class":472,"line":574},[470,855,822],{"class":480},[470,857,858],{"class":825},"model",[470,860,813],{"class":480},[470,862,647],{"class":480},[470,864,865],{"class":480}," \"",[470,867,868],{"class":497},"claude-sonnet-4.6",[470,870,813],{"class":480},[470,872,670],{"class":480},[470,874,875,877,880,882,884,886,889,891],{"class":472,"line":597},[470,876,822],{"class":480},[470,878,879],{"class":825},"provider",[470,881,813],{"class":480},[470,883,647],{"class":480},[470,885,865],{"class":480},[470,887,888],{"class":497},"anthropic",[470,890,813],{"class":480},[470,892,670],{"class":480},[470,894,895,897,900,902,904,907],{"class":472,"line":616},[470,896,822],{"class":480},[470,898,899],{"class":825},"inputTokens",[470,901,813],{"class":480},[470,903,647],{"class":480},[470,905,906],{"class":833}," 3500",[470,908,670],{"class":480},[470,910,911,913,916,918,920,923],{"class":472,"line":621},[470,912,822],{"class":480},[470,914,915],{"class":825},"outputTokens",[470,917,813],{"class":480},[470,919,647],{"class":480},[470,921,922],{"class":833}," 800",[470,924,670],{"class":480},[470,926,927,929,932,934,936,939],{"class":472,"line":641},[470,928,822],{"class":480},[470,930,931],{"class":825},"totalTokens",[470,933,813],{"class":480},[470,935,647],{"class":480},[470,937,938],{"class":833}," 4300",[470,940,670],{"class":480},[470,942,943,945,948,950,952,954,956,959,961,963,965,968,970],{"class":472,"line":673},[470,944,822],{"class":480},[470,946,947],{"class":825},"toolCalls",[470,949,813],{"class":480},[470,951,647],{"class":480},[470,953,726],{"class":480},[470,955,813],{"class":480},[470,957,958],{"class":497},"getWeather",[470,960,813],{"class":480},[470,962,514],{"class":480},[470,964,865],{"class":480},[470,966,967],{"class":497},"searchDB",[470,969,813],{"class":480},[470,971,972],{"class":480},"],\n",[470,974,975,977,980,982,984],{"class":472,"line":694},[470,976,822],{"class":480},[470,978,979],{"class":825},"tools",[470,981,813],{"class":480},[470,983,647],{"class":480},[470,985,986],{"class":480}," [\n",[470,988,989,992,994,997,999,1001,1003,1005,1007,1009,1011,1014,1016,1018,1021,1023,1025,1028,1030,1032,1034],{"class":472,"line":704},[470,990,991],{"class":480},"      {",[470,993,865],{"class":480},[470,995,996],{"class":833},"name",[470,998,813],{"class":480},[470,1000,647],{"class":480},[470,1002,865],{"class":480},[470,1004,958],{"class":497},[470,1006,813],{"class":480},[470,1008,514],{"class":480},[470,1010,865],{"class":480},[470,1012,1013],{"class":833},"durationMs",[470,1015,813],{"class":480},[470,1017,647],{"class":480},[470,1019,1020],{"class":833}," 150",[470,1022,514],{"class":480},[470,1024,865],{"class":480},[470,1026,1027],{"class":833},"success",[470,1029,813],{"class":480},[470,1031,647],{"class":480},[470,1033,713],{"class":480},[470,1035,691],{"class":480},[470,1037,1038,1040,1042,1044,1046,1048,1050,1052,1054,1056,1058,1060,1062,1064,1067,1069,1071,1073,1075,1077,1079],{"class":472,"line":718},[470,1039,991],{"class":480},[470,1041,865],{"class":480},[470,1043,996],{"class":833},[470,1045,813],{"class":480},[470,1047,647],{"class":480},[470,1049,865],{"class":480},[470,1051,967],{"class":497},[470,1053,813],{"class":480},[470,1055,514],{"class":480},[470,1057,865],{"class":480},[470,1059,1013],{"class":833},[470,1061,813],{"class":480},[470,1063,647],{"class":480},[470,1065,1066],{"class":833}," 45",[470,1068,514],{"class":480},[470,1070,865],{"class":480},[470,1072,1027],{"class":833},[470,1074,813],{"class":480},[470,1076,647],{"class":480},[470,1078,713],{"class":480},[470,1080,780],{"class":480},[470,1082,1083],{"class":472,"line":741},[470,1084,1085],{"class":480},"    ],\n",[470,1087,1088,1090,1093,1095,1097,1100],{"class":472,"line":747},[470,1089,822],{"class":480},[470,1091,1092],{"class":825},"totalDurationMs",[470,1094,813],{"class":480},[470,1096,647],{"class":480},[470,1098,1099],{"class":833}," 2340",[470,1101,670],{"class":480},[470,1103,1104,1106,1109,1111,1113,1116],{"class":472,"line":755},[470,1105,822],{"class":480},[470,1107,1108],{"class":825},"msToFirstChunk",[470,1110,813],{"class":480},[470,1112,647],{"class":480},[470,1114,1115],{"class":833}," 180",[470,1117,670],{"class":480},[470,1119,1120,1122,1125,1127,1129,1132],{"class":472,"line":760},[470,1121,822],{"class":480},[470,1123,1124],{"class":825},"msToFinish",[470,1126,813],{"class":480},[470,1128,647],{"class":480},[470,1130,1131],{"class":833}," 2100",[470,1133,670],{"class":480},[470,1135,1136,1138,1141,1143,1145],{"class":472,"line":783},[470,1137,822],{"class":480},[470,1139,1140],{"class":825},"tokensPerSecond",[470,1142,813],{"class":480},[470,1144,647],{"class":480},[470,1146,1147],{"class":833}," 380\n",[470,1149,1151],{"class":472,"line":1150},19,[470,1152,1153],{"class":480},"  }\n",[470,1155,1157],{"class":472,"line":1156},20,[470,1158,1159],{"class":480},"}\n",[444,1161,1163],{"id":1162},"standalone-without-middleware","Standalone (without middleware)",[428,1165,1166],{},"If your model is already wrapped (e.g. by another middleware), pass the request logger directly:",[460,1168,1171],{"className":462,"code":1169,"filename":1170,"language":465,"meta":466,"style":466},"import { createEvlogIntegration } from 'evlog\u002Fai'\n\nconst integration = createEvlogIntegration(log)\n\nconst result = await generateText({\n  model: somePreWrappedModel,\n  experimental_telemetry: {\n    isEnabled: true,\n    integrations: [integration],\n  },\n})\n","server\u002Fapi\u002Fchat.post.ts",[431,1172,1173,1191,1195,1211,1215,1232,1244,1253,1264,1276,1281],{"__ignoreMap":466},[470,1174,1175,1177,1179,1181,1183,1185,1187,1189],{"class":472,"line":473},[470,1176,477],{"class":476},[470,1178,481],{"class":480},[470,1180,517],{"class":484},[470,1182,488],{"class":480},[470,1184,491],{"class":476},[470,1186,494],{"class":480},[470,1188,526],{"class":497},[470,1190,501],{"class":480},[470,1192,1193],{"class":472,"line":504},[470,1194,535],{"emptyLinePlaceholder":534},[470,1196,1197,1200,1203,1206,1208],{"class":472,"line":531},[470,1198,1199],{"class":554},"const",[470,1201,1202],{"class":484}," integration ",[470,1204,1205],{"class":480},"=",[470,1207,517],{"class":547},[470,1209,1210],{"class":484},"(log)\n",[470,1212,1213],{"class":472,"line":538},[470,1214,535],{"emptyLinePlaceholder":534},[470,1216,1217,1219,1222,1224,1226,1228,1230],{"class":472,"line":574},[470,1218,1199],{"class":554},[470,1220,1221],{"class":484}," result ",[470,1223,1205],{"class":480},[470,1225,631],{"class":476},[470,1227,485],{"class":547},[470,1229,551],{"class":484},[470,1231,638],{"class":480},[470,1233,1234,1237,1239,1242],{"class":472,"line":597},[470,1235,1236],{"class":589},"  model",[470,1238,647],{"class":480},[470,1240,1241],{"class":484}," somePreWrappedModel",[470,1243,670],{"class":480},[470,1245,1246,1249,1251],{"class":472,"line":616},[470,1247,1248],{"class":589},"  experimental_telemetry",[470,1250,647],{"class":480},[470,1252,571],{"class":480},[470,1254,1255,1258,1260,1262],{"class":472,"line":621},[470,1256,1257],{"class":589},"    isEnabled",[470,1259,647],{"class":480},[470,1261,713],{"class":712},[470,1263,670],{"class":480},[470,1265,1266,1269,1271,1274],{"class":472,"line":641},[470,1267,1268],{"class":589},"    integrations",[470,1270,647],{"class":480},[470,1272,1273],{"class":484}," [integration]",[470,1275,670],{"class":480},[470,1277,1278],{"class":472,"line":673},[470,1279,1280],{"class":480},"  },\n",[470,1282,1283,1285],{"class":472,"line":694},[470,1284,786],{"class":480},[470,1286,594],{"class":484},[444,1288,1290],{"id":1289},"what-the-integration-captures","What the integration captures",[1292,1293,1294,1310],"table",{},[1295,1296,1297],"thead",{},[1298,1299,1300,1304,1307],"tr",{},[1301,1302,1303],"th",{},"Data",[1301,1305,1306],{},"Source",[1301,1308,1309],{},"Description",[1311,1312,1313,1341],"tbody",{},[1298,1314,1315,1321,1326],{},[1316,1317,1318],"td",{},[431,1319,1320],{},"ai.tools[]",[1316,1322,1323],{},[431,1324,1325],{},"onToolCallFinish",[1316,1327,1328,1329,1331,1332,1331,1334,1336,1337,1340],{},"Per-tool ",[431,1330,996],{},", ",[431,1333,1013],{},[431,1335,1027],{},", and ",[431,1338,1339],{},"error"," (if failed)",[1298,1342,1343,1348,1357],{},[1316,1344,1345],{},[431,1346,1347],{},"ai.totalDurationMs",[1316,1349,1350,1353,1354],{},[431,1351,1352],{},"onStart"," → ",[431,1355,1356],{},"onFinish",[1316,1358,1359],{},"Total wall time from generation start to completion",[428,1361,1362],{},"The middleware captures tokens, model info, and streaming metrics. The integration captures tool execution timing. Together, they give you complete AI observability.",[444,1364,1366],{"id":1365},"composability","Composability",[428,1368,1369,1372,1373,647],{},[431,1370,1371],{},"ai.wrap()"," works with models that are already wrapped by other tools. If you use supermemory, guardrails middleware, or any other model wrapper, pass the wrapped model to ",[431,1374,1371],{},[460,1376,1378],{"className":462,"code":1377,"filename":1170,"language":465,"meta":466,"style":466},"import { createAILogger } from 'evlog\u002Fai'\nimport { withSupermemory } from '@supermemory\u002Ftools\u002Fai-sdk'\nimport { createGateway } from 'ai'\n\nconst gateway = createGateway({ ... })\nconst ai = createAILogger(log)\nconst base = gateway('anthropic\u002Fclaude-sonnet-4.6')\nconst model = ai.wrap(withSupermemory(base, 'your-org-id', { mode: 'full' }))\n",[431,1379,1380,1398,1418,1437,1441,1464,1477,1499],{"__ignoreMap":466},[470,1381,1382,1384,1386,1388,1390,1392,1394,1396],{"class":472,"line":473},[470,1383,477],{"class":476},[470,1385,481],{"class":480},[470,1387,511],{"class":484},[470,1389,488],{"class":480},[470,1391,491],{"class":476},[470,1393,494],{"class":480},[470,1395,526],{"class":497},[470,1397,501],{"class":480},[470,1399,1400,1402,1404,1407,1409,1411,1413,1416],{"class":472,"line":504},[470,1401,477],{"class":476},[470,1403,481],{"class":480},[470,1405,1406],{"class":484}," withSupermemory",[470,1408,488],{"class":480},[470,1410,491],{"class":476},[470,1412,494],{"class":480},[470,1414,1415],{"class":497},"@supermemory\u002Ftools\u002Fai-sdk",[470,1417,501],{"class":480},[470,1419,1420,1422,1424,1427,1429,1431,1433,1435],{"class":472,"line":531},[470,1421,477],{"class":476},[470,1423,481],{"class":480},[470,1425,1426],{"class":484}," createGateway",[470,1428,488],{"class":480},[470,1430,491],{"class":476},[470,1432,494],{"class":480},[470,1434,498],{"class":497},[470,1436,501],{"class":480},[470,1438,1439],{"class":472,"line":538},[470,1440,535],{"emptyLinePlaceholder":534},[470,1442,1443,1445,1448,1450,1452,1454,1457,1460,1462],{"class":472,"line":574},[470,1444,1199],{"class":554},[470,1446,1447],{"class":484}," gateway ",[470,1449,1205],{"class":480},[470,1451,1426],{"class":547},[470,1453,551],{"class":484},[470,1455,1456],{"class":480},"{",[470,1458,1459],{"class":480}," ...",[470,1461,488],{"class":480},[470,1463,594],{"class":484},[470,1465,1466,1468,1471,1473,1475],{"class":472,"line":597},[470,1467,1199],{"class":554},[470,1469,1470],{"class":484}," ai ",[470,1472,1205],{"class":480},[470,1474,511],{"class":547},[470,1476,1210],{"class":484},[470,1478,1479,1481,1484,1486,1489,1491,1493,1495,1497],{"class":472,"line":616},[470,1480,1199],{"class":554},[470,1482,1483],{"class":484}," base ",[470,1485,1205],{"class":480},[470,1487,1488],{"class":547}," gateway",[470,1490,551],{"class":484},[470,1492,660],{"class":480},[470,1494,663],{"class":497},[470,1496,660],{"class":480},[470,1498,594],{"class":484},[470,1500,1501,1503,1506,1508,1510,1512,1514,1516,1519,1522,1524,1526,1529,1531,1533,1535,1538,1540,1542,1545,1547,1549],{"class":472,"line":621},[470,1502,1199],{"class":554},[470,1504,1505],{"class":484}," model ",[470,1507,1205],{"class":480},[470,1509,602],{"class":484},[470,1511,652],{"class":480},[470,1513,655],{"class":547},[470,1515,551],{"class":484},[470,1517,1518],{"class":547},"withSupermemory",[470,1520,1521],{"class":484},"(base",[470,1523,514],{"class":480},[470,1525,494],{"class":480},[470,1527,1528],{"class":497},"your-org-id",[470,1530,660],{"class":480},[470,1532,514],{"class":480},[470,1534,481],{"class":480},[470,1536,1537],{"class":589}," mode",[470,1539,647],{"class":480},[470,1541,494],{"class":480},[470,1543,1544],{"class":497},"full",[470,1546,660],{"class":480},[470,1548,488],{"class":480},[470,1550,1551],{"class":484},"))\n",[428,1553,1554,1555,1558,1559,647],{},"For explicit middleware composition, use ",[431,1556,1557],{},"createAIMiddleware"," to get the raw middleware and compose it yourself via ",[431,1560,1561],{},"wrapLanguageModel",[460,1563,1565],{"className":462,"code":1564,"filename":1170,"language":465,"meta":466,"style":466},"import { createAIMiddleware } from 'evlog\u002Fai'\nimport { wrapLanguageModel } from 'ai'\n\nconst model = wrapLanguageModel({\n  model: base,\n  middleware: [createAIMiddleware(log, { toolInputs: true }), otherMiddleware],\n})\n",[431,1566,1567,1586,1605,1609,1623,1634,1670],{"__ignoreMap":466},[470,1568,1569,1571,1573,1576,1578,1580,1582,1584],{"class":472,"line":473},[470,1570,477],{"class":476},[470,1572,481],{"class":480},[470,1574,1575],{"class":484}," createAIMiddleware",[470,1577,488],{"class":480},[470,1579,491],{"class":476},[470,1581,494],{"class":480},[470,1583,526],{"class":497},[470,1585,501],{"class":480},[470,1587,1588,1590,1592,1595,1597,1599,1601,1603],{"class":472,"line":504},[470,1589,477],{"class":476},[470,1591,481],{"class":480},[470,1593,1594],{"class":484}," wrapLanguageModel",[470,1596,488],{"class":480},[470,1598,491],{"class":476},[470,1600,494],{"class":480},[470,1602,498],{"class":497},[470,1604,501],{"class":480},[470,1606,1607],{"class":472,"line":531},[470,1608,535],{"emptyLinePlaceholder":534},[470,1610,1611,1613,1615,1617,1619,1621],{"class":472,"line":538},[470,1612,1199],{"class":554},[470,1614,1505],{"class":484},[470,1616,1205],{"class":480},[470,1618,1594],{"class":547},[470,1620,551],{"class":484},[470,1622,638],{"class":480},[470,1624,1625,1627,1629,1632],{"class":472,"line":574},[470,1626,1236],{"class":589},[470,1628,647],{"class":480},[470,1630,1631],{"class":484}," base",[470,1633,670],{"class":480},[470,1635,1636,1639,1641,1643,1645,1648,1650,1652,1655,1657,1659,1661,1663,1665,1668],{"class":472,"line":597},[470,1637,1638],{"class":589},"  middleware",[470,1640,647],{"class":480},[470,1642,726],{"class":484},[470,1644,1557],{"class":547},[470,1646,1647],{"class":484},"(log",[470,1649,514],{"class":480},[470,1651,481],{"class":480},[470,1653,1654],{"class":589}," toolInputs",[470,1656,647],{"class":480},[470,1658,713],{"class":712},[470,1660,488],{"class":480},[470,1662,565],{"class":484},[470,1664,514],{"class":480},[470,1666,1667],{"class":484}," otherMiddleware]",[470,1669,670],{"class":480},[470,1671,1672,1674],{"class":472,"line":616},[470,1673,786],{"class":480},[470,1675,594],{"class":484},[428,1677,1678,1680,1681,1683,1684,1686,1687,1690,1691,1693,1694,1696],{},[431,1679,1557],{}," returns the same middleware that ",[431,1682,433],{}," uses internally. The difference: ",[431,1685,1557],{}," does not include ",[431,1688,1689],{},"captureEmbed"," (embedding models don't use middleware). Use ",[431,1692,433],{}," for the full API, ",[431,1695,1557],{}," when you need explicit middleware ordering.",[1698,1699,1700],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}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 .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}",{"title":466,"searchDepth":504,"depth":504,"links":1702},[1703,1704,1705,1706],{"id":446,"depth":504,"text":447},{"id":1162,"depth":504,"text":1163},{"id":1289,"depth":504,"text":1290},{"id":1365,"depth":504,"text":1366},"Add tool execution timing and total wall time with createEvlogIntegration. Compose with other middleware like supermemory or guardrails.","md",[1710,1713],{"label":41,"icon":44,"to":77,"color":1711,"variant":1712},"neutral","subtle",{"label":1714,"icon":83,"to":81,"color":1711,"variant":1712},"Usage Patterns",{},{"title":95,"icon":98},{"title":423,"description":1707},"WhbBRzREyxKmgO14d6e8TZxaYaYlecS7spxQ6m5kUtw",[1720,1722],{"title":90,"path":91,"stem":92,"description":1721,"icon":93,"children":-1},"Read AI metadata from your handler — persist it, surface it to end-users, bill against it, or stream incremental progress to the client.",{"title":41,"path":106,"stem":107,"description":1723,"icon":44,"children":-1},"Automatically identify users on every request. Every wide event includes who made the request — userId, user profile, and session metadata — with zero manual work.",1778333323676]