[{"data":1,"prerenderedAt":1481},["ShallowReactive",2],{"navigation_docs":3,"-logging-better-auth-identify-user":392,"-logging-better-auth-identify-user-surround":1476},[4,35,159,201,289,376],{"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},"Adapters","\u002Fadapters","6.adapters",[294,297,337,352],{"title":41,"path":295,"stem":296,"icon":44},"\u002Fadapters\u002Foverview","6.adapters\u002F01.overview",{"title":298,"path":299,"stem":300,"children":301,"page":34},"Cloud destinations","\u002Fadapters\u002Fcloud","6.adapters\u002F02.cloud",[302,307,312,317,322,327,332],{"title":303,"path":304,"stem":305,"icon":306},"Axiom","\u002Fadapters\u002Fcloud\u002Faxiom","6.adapters\u002F02.cloud\u002F01.axiom","i-custom-axiom",{"title":308,"path":309,"stem":310,"icon":311},"OTLP","\u002Fadapters\u002Fcloud\u002Fotlp","6.adapters\u002F02.cloud\u002F02.otlp","i-simple-icons-opentelemetry",{"title":313,"path":314,"stem":315,"icon":316},"PostHog","\u002Fadapters\u002Fcloud\u002Fposthog","6.adapters\u002F02.cloud\u002F03.posthog","i-simple-icons-posthog",{"title":318,"path":319,"stem":320,"icon":321},"Sentry","\u002Fadapters\u002Fcloud\u002Fsentry","6.adapters\u002F02.cloud\u002F04.sentry","i-simple-icons-sentry",{"title":323,"path":324,"stem":325,"icon":326},"Better Stack","\u002Fadapters\u002Fcloud\u002Fbetter-stack","6.adapters\u002F02.cloud\u002F05.better-stack","i-simple-icons-betterstack",{"title":328,"path":329,"stem":330,"icon":331},"Datadog","\u002Fadapters\u002Fcloud\u002Fdatadog","6.adapters\u002F02.cloud\u002F06.datadog","i-simple-icons-datadog",{"title":333,"path":334,"stem":335,"icon":336},"HyperDX","\u002Fadapters\u002Fcloud\u002Fhyperdx","6.adapters\u002F02.cloud\u002F07.hyperdx","i-custom-hyperdx",{"title":338,"path":339,"stem":340,"children":341,"page":34},"Self-hosted","\u002Fadapters\u002Fself-hosted","6.adapters\u002F03.self-hosted",[342,347],{"title":343,"path":344,"stem":345,"icon":346},"File System","\u002Fadapters\u002Fself-hosted\u002Ffs","6.adapters\u002F03.self-hosted\u002F01.fs","i-lucide-hard-drive",{"title":348,"path":349,"stem":350,"icon":351},"NuxtHub","\u002Fadapters\u002Fself-hosted\u002Fnuxthub","6.adapters\u002F03.self-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":353,"path":354,"stem":355,"children":356,"page":34},"Building blocks","\u002Fadapters\u002Fbuilding-blocks","6.adapters\u002F04.building-blocks",[357,362,367,371],{"title":358,"path":359,"stem":360,"icon":361},"Pipeline","\u002Fadapters\u002Fbuilding-blocks\u002Fpipeline","6.adapters\u002F04.building-blocks\u002F01.pipeline","i-lucide-workflow",{"title":363,"path":364,"stem":365,"icon":366},"HTTP","\u002Fadapters\u002Fbuilding-blocks\u002Fhttp","6.adapters\u002F04.building-blocks\u002F02.http","i-lucide-globe",{"title":368,"path":369,"stem":370,"icon":83},"Custom Adapters","\u002Fadapters\u002Fbuilding-blocks\u002Fcustom","6.adapters\u002F04.building-blocks\u002F03.custom",{"title":372,"path":373,"stem":374,"icon":375},"Toolkit","\u002Fadapters\u002Fbuilding-blocks\u002Ftoolkit","6.adapters\u002F04.building-blocks\u002F04.toolkit","i-lucide-blocks",{"title":377,"path":378,"stem":379,"children":380,"page":34},"Enrichers","\u002Fenrichers","7.enrichers",[381,384,388],{"title":41,"path":382,"stem":383,"icon":28},"\u002Fenrichers\u002Foverview","7.enrichers\u002F1.overview",{"title":385,"path":386,"stem":387,"icon":288},"Built-in","\u002Fenrichers\u002Fbuilt-in","7.enrichers\u002F2.built-in",{"title":389,"path":390,"stem":391,"icon":83},"Custom","\u002Fenrichers\u002Fcustom","7.enrichers\u002F3.custom",{"id":393,"title":394,"body":395,"description":1465,"extension":1466,"links":1467,"meta":1472,"navigation":1473,"path":110,"seo":1474,"stem":111,"__hash__":1475},"docs\u002F2.logging\u002F7.better-auth\u002F02.identify-user.md","identifyUser",{"type":396,"value":397,"toc":1459},"minimark",[398,421,629,637,641,761,845,849,852,882,888,934,938,944,1069,1072,1223,1229,1233,1455],[399,400,401,404,405,408,409,412,413,416,417,420],"p",{},[402,403,394],"code",{}," is the core building block. Take a ",[402,406,407],{},"RequestLogger"," and a Better Auth session, extract safe fields, and call ",[402,410,411],{},"log.set()",". Returns ",[402,414,415],{},"true"," if the user was identified, ",[402,418,419],{},"false"," otherwise.",[422,423,429],"pre",{"className":424,"code":425,"filename":426,"language":427,"meta":428,"style":428},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { identifyUser } from 'evlog\u002Fbetter-auth'\n\nconst session = await auth.api.getSession({ headers: event.headers })\nif (session) {\n  const identified = identifyUser(log, session)\n  if (identified) {\n    log.set({ subscription: 'premium' })\n  }\n}\n","server\u002Fapi\u002Fcheckout.post.ts","typescript","",[402,430,431,464,471,529,541,568,585,617,623],{"__ignoreMap":428},[432,433,436,440,444,448,451,454,457,461],"span",{"class":434,"line":435},"line",1,[432,437,439],{"class":438},"s7zQu","import",[432,441,443],{"class":442},"sMK4o"," {",[432,445,447],{"class":446},"sTEyZ"," identifyUser",[432,449,450],{"class":442}," }",[432,452,453],{"class":438}," from",[432,455,456],{"class":442}," '",[432,458,460],{"class":459},"sfazB","evlog\u002Fbetter-auth",[432,462,463],{"class":442},"'\n",[432,465,467],{"class":434,"line":466},2,[432,468,470],{"emptyLinePlaceholder":469},true,"\n",[432,472,474,478,481,484,487,490,493,496,498,502,505,508,512,515,518,520,523,526],{"class":434,"line":473},3,[432,475,477],{"class":476},"spNyl","const",[432,479,480],{"class":446}," session ",[432,482,483],{"class":442},"=",[432,485,486],{"class":438}," await",[432,488,489],{"class":446}," auth",[432,491,492],{"class":442},".",[432,494,495],{"class":446},"api",[432,497,492],{"class":442},[432,499,501],{"class":500},"s2Zo4","getSession",[432,503,504],{"class":446},"(",[432,506,507],{"class":442},"{",[432,509,511],{"class":510},"swJcz"," headers",[432,513,514],{"class":442},":",[432,516,517],{"class":446}," event",[432,519,492],{"class":442},[432,521,522],{"class":446},"headers ",[432,524,525],{"class":442},"}",[432,527,528],{"class":446},")\n",[432,530,532,535,538],{"class":434,"line":531},4,[432,533,534],{"class":438},"if",[432,536,537],{"class":446}," (session) ",[432,539,540],{"class":442},"{\n",[432,542,544,547,550,553,555,557,560,563,566],{"class":434,"line":543},5,[432,545,546],{"class":476},"  const",[432,548,549],{"class":446}," identified",[432,551,552],{"class":442}," =",[432,554,447],{"class":500},[432,556,504],{"class":510},[432,558,559],{"class":446},"log",[432,561,562],{"class":442},",",[432,564,565],{"class":446}," session",[432,567,528],{"class":510},[432,569,571,574,577,580,583],{"class":434,"line":570},6,[432,572,573],{"class":438},"  if",[432,575,576],{"class":510}," (",[432,578,579],{"class":446},"identified",[432,581,582],{"class":510},") ",[432,584,540],{"class":442},[432,586,588,591,593,596,598,600,603,605,607,610,613,615],{"class":434,"line":587},7,[432,589,590],{"class":446},"    log",[432,592,492],{"class":442},[432,594,595],{"class":500},"set",[432,597,504],{"class":510},[432,599,507],{"class":442},[432,601,602],{"class":510}," subscription",[432,604,514],{"class":442},[432,606,456],{"class":442},[432,608,609],{"class":459},"premium",[432,611,612],{"class":442},"'",[432,614,450],{"class":442},[432,616,528],{"class":510},[432,618,620],{"class":434,"line":619},8,[432,621,622],{"class":442},"  }\n",[432,624,626],{"class":434,"line":625},9,[432,627,628],{"class":442},"}\n",[630,631,632,636],"tip",{},[633,634,635],"strong",{},"Safe by default."," Only whitelisted fields are extracted — passwords, tokens, and secrets are never written to the logger.",[638,639,85],"h2",{"id":640},"options",[642,643,644,663],"table",{},[645,646,647],"thead",{},[648,649,650,654,657,660],"tr",{},[651,652,653],"th",{},"Option",[651,655,656],{},"Type",[651,658,659],{},"Default",[651,661,662],{},"Description",[664,665,666,689,721,741],"tbody",{},[648,667,668,674,679,683],{},[669,670,671],"td",{},[402,672,673],{},"maskEmail",[669,675,676],{},[402,677,678],{},"boolean",[669,680,681],{},[402,682,419],{},[669,684,685,686,492],{},"Mask emails as ",[402,687,688],{},"h***@example.com",[648,690,691,696,700,704],{},[669,692,693],{},[402,694,695],{},"session",[669,697,698],{},[402,699,678],{},[669,701,702],{},[402,703,415],{},[669,705,706,707,710,711,710,714,710,717,720],{},"Include session metadata (",[402,708,709],{},"session.id",", ",[402,712,713],{},"session.expiresAt",[402,715,716],{},"session.ipAddress",[402,718,719],{},"session.userAgent",").",[648,722,723,728,733,738],{},[669,724,725],{},[402,726,727],{},"fields",[669,729,730],{},[402,731,732],{},"string[]",[669,734,735],{},[402,736,737],{},"['id', 'name', 'email', 'image', 'emailVerified', 'createdAt']",[669,739,740],{},"User fields to extract.",[648,742,743,748,753,758],{},[669,744,745],{},[402,746,747],{},"extend",[669,749,750],{},[402,751,752],{},"(session) => Record\u003Cstring, unknown>",[669,754,755],{},[402,756,757],{},"undefined",[669,759,760],{},"Add custom fields from Better Auth plugins (organizations, roles, etc.).",[422,762,764],{"className":424,"code":763,"filename":426,"language":427,"meta":428,"style":428},"identifyUser(log, session, {\n  maskEmail: true,\n  fields: ['id', 'name'],\n  session: false,\n})\n",[402,765,766,782,796,827,839],{"__ignoreMap":428},[432,767,768,770,773,775,777,779],{"class":434,"line":435},[432,769,394],{"class":500},[432,771,772],{"class":446},"(log",[432,774,562],{"class":442},[432,776,565],{"class":446},[432,778,562],{"class":442},[432,780,781],{"class":442}," {\n",[432,783,784,787,789,793],{"class":434,"line":466},[432,785,786],{"class":510},"  maskEmail",[432,788,514],{"class":442},[432,790,792],{"class":791},"sfNiH"," true",[432,794,795],{"class":442},",\n",[432,797,798,801,803,806,808,811,813,815,817,820,822,825],{"class":434,"line":473},[432,799,800],{"class":510},"  fields",[432,802,514],{"class":442},[432,804,805],{"class":446}," [",[432,807,612],{"class":442},[432,809,810],{"class":459},"id",[432,812,612],{"class":442},[432,814,562],{"class":442},[432,816,456],{"class":442},[432,818,819],{"class":459},"name",[432,821,612],{"class":442},[432,823,824],{"class":446},"]",[432,826,795],{"class":442},[432,828,829,832,834,837],{"class":434,"line":531},[432,830,831],{"class":510},"  session",[432,833,514],{"class":442},[432,835,836],{"class":791}," false",[432,838,795],{"class":442},[432,840,841,843],{"class":434,"line":543},[432,842,525],{"class":442},[432,844,528],{"class":446},[638,846,848],{"id":847},"mask-emails","Mask emails",[399,850,851],{},"Emails are PII. In environments where the audit\u002Flog trail might be reviewed by support or third parties, mask them:",[422,853,855],{"className":424,"code":854,"language":427,"meta":428,"style":428},"identifyUser(log, session, { maskEmail: true })\n",[402,856,857],{"__ignoreMap":428},[432,858,859,861,863,865,867,869,871,874,876,878,880],{"class":434,"line":435},[432,860,394],{"class":500},[432,862,772],{"class":446},[432,864,562],{"class":442},[432,866,565],{"class":446},[432,868,562],{"class":442},[432,870,443],{"class":442},[432,872,873],{"class":510}," maskEmail",[432,875,514],{"class":442},[432,877,792],{"class":791},[432,879,450],{"class":442},[432,881,528],{"class":446},[399,883,884,885,887],{},"The ",[402,886,673],{}," helper is also exported on its own:",[422,889,891],{"className":424,"code":890,"language":427,"meta":428,"style":428},"import { maskEmail } from 'evlog\u002Fbetter-auth'\n\nmaskEmail('hugo@example.com') \u002F\u002F 'h***@example.com'\n",[402,892,893,911,915],{"__ignoreMap":428},[432,894,895,897,899,901,903,905,907,909],{"class":434,"line":435},[432,896,439],{"class":438},[432,898,443],{"class":442},[432,900,873],{"class":446},[432,902,450],{"class":442},[432,904,453],{"class":438},[432,906,456],{"class":442},[432,908,460],{"class":459},[432,910,463],{"class":442},[432,912,913],{"class":434,"line":466},[432,914,470],{"emptyLinePlaceholder":469},[432,916,917,919,921,923,926,928,930],{"class":434,"line":473},[432,918,673],{"class":500},[432,920,504],{"class":446},[432,922,612],{"class":442},[432,924,925],{"class":459},"hugo@example.com",[432,927,612],{"class":442},[432,929,582],{"class":446},[432,931,933],{"class":932},"sHwdD","\u002F\u002F 'h***@example.com'\n",[638,935,937],{"id":936},"capture-plugin-fields","Capture plugin fields",[399,939,940,941,943],{},"Better Auth ships with plugins (organizations, 2FA, roles, admin) that add fields to the session. Use ",[402,942,747],{}," to surface them on the wide event:",[422,945,948],{"className":424,"code":946,"filename":947,"language":427,"meta":428,"style":428},"import { createAuthMiddleware } from 'evlog\u002Fbetter-auth'\n\nconst identify = createAuthMiddleware(auth, {\n  extend: (session) => ({\n    organization: session.user.activeOrganization,\n    role: session.user.role,\n  }),\n})\n","server\u002Fmiddleware\u002Fauth-identify.ts",[402,949,950,969,973,991,1013,1034,1054,1063],{"__ignoreMap":428},[432,951,952,954,956,959,961,963,965,967],{"class":434,"line":435},[432,953,439],{"class":438},[432,955,443],{"class":442},[432,957,958],{"class":446}," createAuthMiddleware",[432,960,450],{"class":442},[432,962,453],{"class":438},[432,964,456],{"class":442},[432,966,460],{"class":459},[432,968,463],{"class":442},[432,970,971],{"class":434,"line":466},[432,972,470],{"emptyLinePlaceholder":469},[432,974,975,977,980,982,984,987,989],{"class":434,"line":473},[432,976,477],{"class":476},[432,978,979],{"class":446}," identify ",[432,981,483],{"class":442},[432,983,958],{"class":500},[432,985,986],{"class":446},"(auth",[432,988,562],{"class":442},[432,990,781],{"class":442},[432,992,993,996,998,1000,1003,1006,1009,1011],{"class":434,"line":531},[432,994,995],{"class":500},"  extend",[432,997,514],{"class":442},[432,999,576],{"class":442},[432,1001,695],{"class":1002},"sHdIc",[432,1004,1005],{"class":442},")",[432,1007,1008],{"class":476}," =>",[432,1010,576],{"class":446},[432,1012,540],{"class":442},[432,1014,1015,1018,1020,1022,1024,1027,1029,1032],{"class":434,"line":543},[432,1016,1017],{"class":510},"    organization",[432,1019,514],{"class":442},[432,1021,565],{"class":446},[432,1023,492],{"class":442},[432,1025,1026],{"class":446},"user",[432,1028,492],{"class":442},[432,1030,1031],{"class":446},"activeOrganization",[432,1033,795],{"class":442},[432,1035,1036,1039,1041,1043,1045,1047,1049,1052],{"class":434,"line":570},[432,1037,1038],{"class":510},"    role",[432,1040,514],{"class":442},[432,1042,565],{"class":446},[432,1044,492],{"class":442},[432,1046,1026],{"class":446},[432,1048,492],{"class":442},[432,1050,1051],{"class":446},"role",[432,1053,795],{"class":442},[432,1055,1056,1059,1061],{"class":434,"line":587},[432,1057,1058],{"class":442},"  }",[432,1060,1005],{"class":446},[432,1062,795],{"class":442},[432,1064,1065,1067],{"class":434,"line":619},[432,1066,525],{"class":442},[432,1068,528],{"class":446},[399,1070,1071],{},"Wide event with plugin fields:",[422,1073,1078],{"className":1074,"code":1075,"filename":1076,"language":1077,"meta":428,"style":428},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"userId\": \"QBX9tPjJQExWawAbNll75\",\n  \"user\": { \"id\": \"QBX9tPjJQExWawAbNll75\", \"name\": \"Hugo Richard\" },\n  \"organization\": { \"id\": \"org_42\", \"name\": \"Acme\" },\n  \"role\": \"admin\"\n}\n","Wide Event","json",[402,1079,1080,1084,1107,1154,1201,1219],{"__ignoreMap":428},[432,1081,1082],{"class":434,"line":435},[432,1083,540],{"class":442},[432,1085,1086,1089,1092,1095,1097,1100,1103,1105],{"class":434,"line":466},[432,1087,1088],{"class":442},"  \"",[432,1090,1091],{"class":476},"userId",[432,1093,1094],{"class":442},"\"",[432,1096,514],{"class":442},[432,1098,1099],{"class":442}," \"",[432,1101,1102],{"class":459},"QBX9tPjJQExWawAbNll75",[432,1104,1094],{"class":442},[432,1106,795],{"class":442},[432,1108,1109,1111,1113,1115,1117,1119,1121,1124,1126,1128,1130,1132,1134,1136,1138,1140,1142,1144,1146,1149,1151],{"class":434,"line":473},[432,1110,1088],{"class":442},[432,1112,1026],{"class":476},[432,1114,1094],{"class":442},[432,1116,514],{"class":442},[432,1118,443],{"class":442},[432,1120,1099],{"class":442},[432,1122,810],{"class":1123},"sBMFI",[432,1125,1094],{"class":442},[432,1127,514],{"class":442},[432,1129,1099],{"class":442},[432,1131,1102],{"class":459},[432,1133,1094],{"class":442},[432,1135,562],{"class":442},[432,1137,1099],{"class":442},[432,1139,819],{"class":1123},[432,1141,1094],{"class":442},[432,1143,514],{"class":442},[432,1145,1099],{"class":442},[432,1147,1148],{"class":459},"Hugo Richard",[432,1150,1094],{"class":442},[432,1152,1153],{"class":442}," },\n",[432,1155,1156,1158,1161,1163,1165,1167,1169,1171,1173,1175,1177,1180,1182,1184,1186,1188,1190,1192,1194,1197,1199],{"class":434,"line":531},[432,1157,1088],{"class":442},[432,1159,1160],{"class":476},"organization",[432,1162,1094],{"class":442},[432,1164,514],{"class":442},[432,1166,443],{"class":442},[432,1168,1099],{"class":442},[432,1170,810],{"class":1123},[432,1172,1094],{"class":442},[432,1174,514],{"class":442},[432,1176,1099],{"class":442},[432,1178,1179],{"class":459},"org_42",[432,1181,1094],{"class":442},[432,1183,562],{"class":442},[432,1185,1099],{"class":442},[432,1187,819],{"class":1123},[432,1189,1094],{"class":442},[432,1191,514],{"class":442},[432,1193,1099],{"class":442},[432,1195,1196],{"class":459},"Acme",[432,1198,1094],{"class":442},[432,1200,1153],{"class":442},[432,1202,1203,1205,1207,1209,1211,1213,1216],{"class":434,"line":543},[432,1204,1088],{"class":442},[432,1206,1051],{"class":476},[432,1208,1094],{"class":442},[432,1210,514],{"class":442},[432,1212,1099],{"class":442},[432,1214,1215],{"class":459},"admin",[432,1217,1218],{"class":442},"\"\n",[432,1220,1221],{"class":434,"line":570},[432,1222,628],{"class":442},[630,1224,1225,1226,1228],{},"Keep ",[402,1227,747],{}," deterministic — it runs on every request. Avoid heavy computations or extra database calls inside it; query the data Better Auth already loaded into the session.",[638,1230,1232],{"id":1231},"captured-fields","Captured fields",[642,1234,1235,1247],{},[645,1236,1237],{},[648,1238,1239,1242,1245],{},[651,1240,1241],{},"Field",[651,1243,1244],{},"Source",[651,1246,662],{},[664,1248,1249,1266,1280,1295,1313,1328,1343,1358,1372,1386,1400,1414,1429,1442],{},[648,1250,1251,1255,1260],{},[669,1252,1253],{},[402,1254,1091],{},[669,1256,1257],{},[402,1258,1259],{},"session.user.id",[669,1261,1262,1263,720],{},"Top-level user ID (used by PostHog adapter as ",[402,1264,1265],{},"distinct_id",[648,1267,1268,1273,1277],{},[669,1269,1270],{},[402,1271,1272],{},"user.id",[669,1274,1275],{},[402,1276,1259],{},[669,1278,1279],{},"User ID.",[648,1281,1282,1287,1292],{},[669,1283,1284],{},[402,1285,1286],{},"user.name",[669,1288,1289],{},[402,1290,1291],{},"session.user.name",[669,1293,1294],{},"Display name.",[648,1296,1297,1302,1307],{},[669,1298,1299],{},[402,1300,1301],{},"user.email",[669,1303,1304],{},[402,1305,1306],{},"session.user.email",[669,1308,1309,1310,720],{},"Email (maskable with ",[402,1311,1312],{},"maskEmail: true",[648,1314,1315,1320,1325],{},[669,1316,1317],{},[402,1318,1319],{},"user.image",[669,1321,1322],{},[402,1323,1324],{},"session.user.image",[669,1326,1327],{},"Avatar URL.",[648,1329,1330,1335,1340],{},[669,1331,1332],{},[402,1333,1334],{},"user.emailVerified",[669,1336,1337],{},[402,1338,1339],{},"session.user.emailVerified",[669,1341,1342],{},"Email verification status.",[648,1344,1345,1350,1355],{},[669,1346,1347],{},[402,1348,1349],{},"user.createdAt",[669,1351,1352],{},[402,1353,1354],{},"session.user.createdAt",[669,1356,1357],{},"Account creation date (ISO string).",[648,1359,1360,1364,1369],{},[669,1361,1362],{},[402,1363,709],{},[669,1365,1366],{},[402,1367,1368],{},"session.session.id",[669,1370,1371],{},"Session ID.",[648,1373,1374,1378,1383],{},[669,1375,1376],{},[402,1377,713],{},[669,1379,1380],{},[402,1381,1382],{},"session.session.expiresAt",[669,1384,1385],{},"Session expiry (ISO string).",[648,1387,1388,1392,1397],{},[669,1389,1390],{},[402,1391,716],{},[669,1393,1394],{},[402,1395,1396],{},"session.session.ipAddress",[669,1398,1399],{},"Client IP from the session.",[648,1401,1402,1406,1411],{},[669,1403,1404],{},[402,1405,719],{},[669,1407,1408],{},[402,1409,1410],{},"session.session.userAgent",[669,1412,1413],{},"User agent string from the session.",[648,1415,1416,1421,1426],{},[669,1417,1418],{},[402,1419,1420],{},"session.createdAt",[669,1422,1423],{},[402,1424,1425],{},"session.session.createdAt",[669,1427,1428],{},"Session creation date (ISO string).",[648,1430,1431,1436,1439],{},[669,1432,1433],{},[402,1434,1435],{},"auth.resolvedIn",[669,1437,1438],{},"Measured",[669,1440,1441],{},"Session resolution time in ms.",[648,1443,1444,1449,1452],{},[669,1445,1446],{},[402,1447,1448],{},"auth.identified",[669,1450,1451],{},"Computed",[669,1453,1454],{},"Whether the request was identified.",[1456,1457,1458],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html .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 .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}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 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 .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}",{"title":428,"searchDepth":466,"depth":466,"links":1460},[1461,1462,1463,1464],{"id":640,"depth":466,"text":85},{"id":847,"depth":466,"text":848},{"id":936,"depth":466,"text":937},{"id":1231,"depth":466,"text":1232},"The core building block — extract safe user fields, mask emails, and capture plugin data (organizations, roles, 2FA) from a Better Auth session.","md",[1468,1471],{"label":41,"icon":44,"to":106,"color":1469,"variant":1470},"neutral","subtle",{"label":114,"icon":117,"to":115,"color":1469,"variant":1470},{},{"title":109,"icon":112},{"title":394,"description":1465},"VS9eDGagjMCp4wE2OvWnsRAwJP63xIsdRf1r23od9DM",[1477,1479],{"title":41,"path":106,"stem":107,"description":1478,"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.",{"title":114,"path":115,"stem":116,"description":1480,"icon":117,"children":-1},"Framework-agnostic factory with route filtering, session timing, and lifecycle hooks. Call it once at startup and reuse across requests.",1778106401124]