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