[{"data":1,"prerenderedAt":1477},["ShallowReactive",2],{"navigation_docs":3,"-logging-better-auth-identify-user":388,"-logging-better-auth-identify-user-surround":1472},[4,35,155,197,285,372],{"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,94,122],{"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},"Client Logging","\u002Flogging\u002Fclient-logging","2.logging\u002F4.client-logging","i-lucide-monitor",{"title":66,"icon":67,"path":68,"stem":69,"children":70,"page":34},"AI SDK","i-simple-icons-vercel","\u002Flogging\u002Fai-sdk","2.logging\u002F5.ai-sdk",[71,74,79,84,89],{"title":41,"path":72,"stem":73,"icon":44},"\u002Flogging\u002Fai-sdk\u002Foverview","2.logging\u002F5.ai-sdk\u002F01.overview",{"title":75,"path":76,"stem":77,"icon":78},"Usage","\u002Flogging\u002Fai-sdk\u002Fusage","2.logging\u002F5.ai-sdk\u002F02.usage","i-lucide-code",{"title":80,"path":81,"stem":82,"icon":83},"Options","\u002Flogging\u002Fai-sdk\u002Foptions","2.logging\u002F5.ai-sdk\u002F03.options","i-lucide-sliders",{"title":85,"path":86,"stem":87,"icon":88},"Metadata","\u002Flogging\u002Fai-sdk\u002Fmetadata","2.logging\u002F5.ai-sdk\u002F04.metadata","i-lucide-database",{"title":90,"path":91,"stem":92,"icon":93},"Telemetry","\u002Flogging\u002Fai-sdk\u002Ftelemetry","2.logging\u002F5.ai-sdk\u002F05.telemetry","i-lucide-activity",{"title":95,"icon":96,"path":97,"stem":98,"children":99,"page":34},"Better Auth","i-simple-icons-betterauth","\u002Flogging\u002Fbetter-auth","2.logging\u002F6.better-auth",[100,103,108,113,117],{"title":41,"path":101,"stem":102,"icon":44},"\u002Flogging\u002Fbetter-auth\u002Foverview","2.logging\u002F6.better-auth\u002F01.overview",{"title":104,"path":105,"stem":106,"icon":107},"Identify User","\u002Flogging\u002Fbetter-auth\u002Fidentify-user","2.logging\u002F6.better-auth\u002F02.identify-user","i-lucide-user-check",{"title":109,"path":110,"stem":111,"icon":112},"Middleware","\u002Flogging\u002Fbetter-auth\u002Fmiddleware","2.logging\u002F6.better-auth\u002F03.middleware","i-lucide-shield",{"title":114,"path":115,"stem":116,"icon":64},"Client Sync","\u002Flogging\u002Fbetter-auth\u002Fclient-sync","2.logging\u002F6.better-auth\u002F04.client-sync",{"title":118,"path":119,"stem":120,"icon":121},"Performance","\u002Flogging\u002Fbetter-auth\u002Fperformance","2.logging\u002F6.better-auth\u002F05.performance","i-lucide-gauge",{"title":123,"icon":124,"path":125,"stem":126,"children":127,"page":34},"Audit Logs","i-lucide-shield-check","\u002Flogging\u002Faudit","2.logging\u002F7.audit",[128,131,136,141,146,150],{"title":41,"path":129,"stem":130,"icon":44},"\u002Flogging\u002Faudit\u002Foverview","2.logging\u002F7.audit\u002F01.overview",{"title":132,"path":133,"stem":134,"icon":135},"Schema","\u002Flogging\u002Faudit\u002Fschema","2.logging\u002F7.audit\u002F02.schema","i-lucide-file-text",{"title":137,"path":138,"stem":139,"icon":140},"Recording","\u002Flogging\u002Faudit\u002Frecording","2.logging\u002F7.audit\u002F03.recording","i-lucide-pen-line",{"title":142,"path":143,"stem":144,"icon":145},"Drains","\u002Flogging\u002Faudit\u002Fpipeline","2.logging\u002F7.audit\u002F04.pipeline","i-lucide-link",{"title":147,"path":148,"stem":149,"icon":124},"Compliance","\u002Flogging\u002Faudit\u002Fcompliance","2.logging\u002F7.audit\u002F05.compliance",{"title":151,"path":152,"stem":153,"icon":154},"Recipes","\u002Flogging\u002Faudit\u002Frecipes","2.logging\u002F7.audit\u002F06.recipes","i-lucide-book-open",{"title":156,"path":157,"stem":158,"children":159,"page":34},"Core Concepts","\u002Fcore-concepts","3.core-concepts",[160,165,170,175,180,184,187,192],{"title":161,"path":162,"stem":163,"icon":164},"Lifecycle","\u002Fcore-concepts\u002Flifecycle","3.core-concepts\u002F0.lifecycle","i-lucide-arrow-right-left",{"title":166,"path":167,"stem":168,"icon":169},"Configuration","\u002Fcore-concepts\u002Fconfiguration","3.core-concepts\u002F1.configuration","i-lucide-settings",{"title":171,"path":172,"stem":173,"icon":174},"Sampling","\u002Fcore-concepts\u002Fsampling","3.core-concepts\u002F2.sampling","i-lucide-filter",{"title":176,"path":177,"stem":178,"icon":179},"Typed Fields","\u002Fcore-concepts\u002Ftyped-fields","3.core-concepts\u002F3.typed-fields","i-simple-icons-typescript",{"title":181,"path":182,"stem":183,"icon":124},"Best Practices","\u002Fcore-concepts\u002Fbest-practices","3.core-concepts\u002F4.best-practices",{"title":118,"path":185,"stem":186,"icon":121},"\u002Fcore-concepts\u002Fperformance","3.core-concepts\u002F5.performance",{"title":188,"path":189,"stem":190,"icon":191},"Vite Plugin","\u002Fcore-concepts\u002Fvite-plugin","3.core-concepts\u002F6.vite-plugin","i-custom-vite",{"title":193,"path":194,"stem":195,"icon":196},"Auto-Redaction","\u002Fcore-concepts\u002Fredaction","3.core-concepts\u002F7.redaction","i-lucide-eye-off",{"title":198,"path":199,"stem":200,"children":201,"page":34},"Frameworks","\u002Fframeworks","4.frameworks",[202,206,211,216,221,226,231,236,241,246,251,256,261,266,270,275,280],{"title":41,"path":203,"stem":204,"icon":205},"\u002Fframeworks\u002Foverview","4.frameworks\u002F00.overview","i-lucide-layout-grid",{"title":207,"path":208,"stem":209,"icon":210},"Nuxt","\u002Fframeworks\u002Fnuxt","4.frameworks\u002F01.nuxt","i-simple-icons-nuxtdotjs",{"title":212,"path":213,"stem":214,"icon":215},"Next.js","\u002Fframeworks\u002Fnextjs","4.frameworks\u002F02.nextjs","i-simple-icons-nextdotjs",{"title":217,"path":218,"stem":219,"icon":220},"SvelteKit","\u002Fframeworks\u002Fsveltekit","4.frameworks\u002F03.sveltekit","i-simple-icons-svelte",{"title":222,"path":223,"stem":224,"icon":225},"Nitro","\u002Fframeworks\u002Fnitro","4.frameworks\u002F04.nitro","i-custom-nitro",{"title":227,"path":228,"stem":229,"icon":230},"TanStack Start","\u002Fframeworks\u002Ftanstack-start","4.frameworks\u002F05.tanstack-start","i-custom-tanstack",{"title":232,"path":233,"stem":234,"icon":235},"NestJS","\u002Fframeworks\u002Fnestjs","4.frameworks\u002F06.nestjs","i-simple-icons-nestjs",{"title":237,"path":238,"stem":239,"icon":240},"Express","\u002Fframeworks\u002Fexpress","4.frameworks\u002F07.express","i-simple-icons-express",{"title":242,"path":243,"stem":244,"icon":245},"Hono","\u002Fframeworks\u002Fhono","4.frameworks\u002F08.hono","i-simple-icons-hono",{"title":247,"path":248,"stem":249,"icon":250},"Fastify","\u002Fframeworks\u002Ffastify","4.frameworks\u002F09.fastify","i-simple-icons-fastify",{"title":252,"path":253,"stem":254,"icon":255},"Elysia","\u002Fframeworks\u002Felysia","4.frameworks\u002F10.elysia","i-custom-elysia",{"title":257,"path":258,"stem":259,"icon":260},"React Router","\u002Fframeworks\u002Freact-router","4.frameworks\u002F11.react-router","i-custom-reactrouter",{"title":262,"path":263,"stem":264,"icon":265},"Cloudflare Workers","\u002Fframeworks\u002Fcloudflare-workers","4.frameworks\u002F12.cloudflare-workers","i-simple-icons-cloudflare",{"title":267,"path":268,"stem":269,"icon":179},"Standalone","\u002Fframeworks\u002Fstandalone","4.frameworks\u002F13.standalone",{"title":271,"path":272,"stem":273,"icon":274},"Astro","\u002Fframeworks\u002Fastro","4.frameworks\u002F14.astro","i-simple-icons-astro",{"title":276,"path":277,"stem":278,"icon":279},"AWS Lambda","\u002Fframeworks\u002Faws-lambda","4.frameworks\u002F16.aws-lambda","i-custom-lambda",{"title":281,"path":282,"stem":283,"icon":284},"Custom Integration","\u002Fframeworks\u002Fcustom-integration","4.frameworks\u002F17.custom-integration","i-lucide-puzzle",{"title":286,"path":287,"stem":288,"children":289,"page":34},"Adapters","\u002Fadapters","6.adapters",[290,293,333,348],{"title":41,"path":291,"stem":292,"icon":44},"\u002Fadapters\u002Foverview","6.adapters\u002F01.overview",{"title":294,"path":295,"stem":296,"children":297,"page":34},"Cloud destinations","\u002Fadapters\u002Fcloud","6.adapters\u002F02.cloud",[298,303,308,313,318,323,328],{"title":299,"path":300,"stem":301,"icon":302},"Axiom","\u002Fadapters\u002Fcloud\u002Faxiom","6.adapters\u002F02.cloud\u002F01.axiom","i-custom-axiom",{"title":304,"path":305,"stem":306,"icon":307},"OTLP","\u002Fadapters\u002Fcloud\u002Fotlp","6.adapters\u002F02.cloud\u002F02.otlp","i-simple-icons-opentelemetry",{"title":309,"path":310,"stem":311,"icon":312},"PostHog","\u002Fadapters\u002Fcloud\u002Fposthog","6.adapters\u002F02.cloud\u002F03.posthog","i-simple-icons-posthog",{"title":314,"path":315,"stem":316,"icon":317},"Sentry","\u002Fadapters\u002Fcloud\u002Fsentry","6.adapters\u002F02.cloud\u002F04.sentry","i-simple-icons-sentry",{"title":319,"path":320,"stem":321,"icon":322},"Better Stack","\u002Fadapters\u002Fcloud\u002Fbetter-stack","6.adapters\u002F02.cloud\u002F05.better-stack","i-simple-icons-betterstack",{"title":324,"path":325,"stem":326,"icon":327},"Datadog","\u002Fadapters\u002Fcloud\u002Fdatadog","6.adapters\u002F02.cloud\u002F06.datadog","i-simple-icons-datadog",{"title":329,"path":330,"stem":331,"icon":332},"HyperDX","\u002Fadapters\u002Fcloud\u002Fhyperdx","6.adapters\u002F02.cloud\u002F07.hyperdx","i-custom-hyperdx",{"title":334,"path":335,"stem":336,"children":337,"page":34},"Self-hosted","\u002Fadapters\u002Fself-hosted","6.adapters\u002F03.self-hosted",[338,343],{"title":339,"path":340,"stem":341,"icon":342},"File System","\u002Fadapters\u002Fself-hosted\u002Ffs","6.adapters\u002F03.self-hosted\u002F01.fs","i-lucide-hard-drive",{"title":344,"path":345,"stem":346,"icon":347},"NuxtHub","\u002Fadapters\u002Fself-hosted\u002Fnuxthub","6.adapters\u002F03.self-hosted\u002F02.nuxthub","i-simple-icons-nuxt",{"title":349,"path":350,"stem":351,"children":352,"page":34},"Building blocks","\u002Fadapters\u002Fbuilding-blocks","6.adapters\u002F04.building-blocks",[353,358,363,367],{"title":354,"path":355,"stem":356,"icon":357},"Pipeline","\u002Fadapters\u002Fbuilding-blocks\u002Fpipeline","6.adapters\u002F04.building-blocks\u002F01.pipeline","i-lucide-workflow",{"title":359,"path":360,"stem":361,"icon":362},"HTTP","\u002Fadapters\u002Fbuilding-blocks\u002Fhttp","6.adapters\u002F04.building-blocks\u002F02.http","i-lucide-globe",{"title":364,"path":365,"stem":366,"icon":78},"Custom Adapters","\u002Fadapters\u002Fbuilding-blocks\u002Fcustom","6.adapters\u002F04.building-blocks\u002F03.custom",{"title":368,"path":369,"stem":370,"icon":371},"Toolkit","\u002Fadapters\u002Fbuilding-blocks\u002Ftoolkit","6.adapters\u002F04.building-blocks\u002F04.toolkit","i-lucide-blocks",{"title":373,"path":374,"stem":375,"children":376,"page":34},"Enrichers","\u002Fenrichers","7.enrichers",[377,380,384],{"title":41,"path":378,"stem":379,"icon":28},"\u002Fenrichers\u002Foverview","7.enrichers\u002F1.overview",{"title":381,"path":382,"stem":383,"icon":284},"Built-in","\u002Fenrichers\u002Fbuilt-in","7.enrichers\u002F2.built-in",{"title":385,"path":386,"stem":387,"icon":78},"Custom","\u002Fenrichers\u002Fcustom","7.enrichers\u002F3.custom",{"id":389,"title":390,"body":391,"description":1461,"extension":1462,"links":1463,"meta":1468,"navigation":1469,"path":105,"seo":1470,"stem":106,"__hash__":1471},"docs\u002F2.logging\u002F6.better-auth\u002F02.identify-user.md","identifyUser",{"type":392,"value":393,"toc":1455},"minimark",[394,417,625,633,637,757,841,845,848,878,884,930,934,940,1065,1068,1219,1225,1229,1451],[395,396,397,400,401,404,405,408,409,412,413,416],"p",{},[398,399,390],"code",{}," is the core building block. Take a ",[398,402,403],{},"RequestLogger"," and a Better Auth session, extract safe fields, and call ",[398,406,407],{},"log.set()",". Returns ",[398,410,411],{},"true"," if the user was identified, ",[398,414,415],{},"false"," otherwise.",[418,419,425],"pre",{"className":420,"code":421,"filename":422,"language":423,"meta":424,"style":424},"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","",[398,426,427,460,467,525,537,564,581,613,619],{"__ignoreMap":424},[428,429,432,436,440,444,447,450,453,457],"span",{"class":430,"line":431},"line",1,[428,433,435],{"class":434},"s7zQu","import",[428,437,439],{"class":438},"sMK4o"," {",[428,441,443],{"class":442},"sTEyZ"," identifyUser",[428,445,446],{"class":438}," }",[428,448,449],{"class":434}," from",[428,451,452],{"class":438}," '",[428,454,456],{"class":455},"sfazB","evlog\u002Fbetter-auth",[428,458,459],{"class":438},"'\n",[428,461,463],{"class":430,"line":462},2,[428,464,466],{"emptyLinePlaceholder":465},true,"\n",[428,468,470,474,477,480,483,486,489,492,494,498,501,504,508,511,514,516,519,522],{"class":430,"line":469},3,[428,471,473],{"class":472},"spNyl","const",[428,475,476],{"class":442}," session ",[428,478,479],{"class":438},"=",[428,481,482],{"class":434}," await",[428,484,485],{"class":442}," auth",[428,487,488],{"class":438},".",[428,490,491],{"class":442},"api",[428,493,488],{"class":438},[428,495,497],{"class":496},"s2Zo4","getSession",[428,499,500],{"class":442},"(",[428,502,503],{"class":438},"{",[428,505,507],{"class":506},"swJcz"," headers",[428,509,510],{"class":438},":",[428,512,513],{"class":442}," event",[428,515,488],{"class":438},[428,517,518],{"class":442},"headers ",[428,520,521],{"class":438},"}",[428,523,524],{"class":442},")\n",[428,526,528,531,534],{"class":430,"line":527},4,[428,529,530],{"class":434},"if",[428,532,533],{"class":442}," (session) ",[428,535,536],{"class":438},"{\n",[428,538,540,543,546,549,551,553,556,559,562],{"class":430,"line":539},5,[428,541,542],{"class":472},"  const",[428,544,545],{"class":442}," identified",[428,547,548],{"class":438}," =",[428,550,443],{"class":496},[428,552,500],{"class":506},[428,554,555],{"class":442},"log",[428,557,558],{"class":438},",",[428,560,561],{"class":442}," session",[428,563,524],{"class":506},[428,565,567,570,573,576,579],{"class":430,"line":566},6,[428,568,569],{"class":434},"  if",[428,571,572],{"class":506}," (",[428,574,575],{"class":442},"identified",[428,577,578],{"class":506},") ",[428,580,536],{"class":438},[428,582,584,587,589,592,594,596,599,601,603,606,609,611],{"class":430,"line":583},7,[428,585,586],{"class":442},"    log",[428,588,488],{"class":438},[428,590,591],{"class":496},"set",[428,593,500],{"class":506},[428,595,503],{"class":438},[428,597,598],{"class":506}," subscription",[428,600,510],{"class":438},[428,602,452],{"class":438},[428,604,605],{"class":455},"premium",[428,607,608],{"class":438},"'",[428,610,446],{"class":438},[428,612,524],{"class":506},[428,614,616],{"class":430,"line":615},8,[428,617,618],{"class":438},"  }\n",[428,620,622],{"class":430,"line":621},9,[428,623,624],{"class":438},"}\n",[626,627,628,632],"tip",{},[629,630,631],"strong",{},"Safe by default."," Only whitelisted fields are extracted — passwords, tokens, and secrets are never written to the logger.",[634,635,80],"h2",{"id":636},"options",[638,639,640,659],"table",{},[641,642,643],"thead",{},[644,645,646,650,653,656],"tr",{},[647,648,649],"th",{},"Option",[647,651,652],{},"Type",[647,654,655],{},"Default",[647,657,658],{},"Description",[660,661,662,685,717,737],"tbody",{},[644,663,664,670,675,679],{},[665,666,667],"td",{},[398,668,669],{},"maskEmail",[665,671,672],{},[398,673,674],{},"boolean",[665,676,677],{},[398,678,415],{},[665,680,681,682,488],{},"Mask emails as ",[398,683,684],{},"h***@example.com",[644,686,687,692,696,700],{},[665,688,689],{},[398,690,691],{},"session",[665,693,694],{},[398,695,674],{},[665,697,698],{},[398,699,411],{},[665,701,702,703,706,707,706,710,706,713,716],{},"Include session metadata (",[398,704,705],{},"session.id",", ",[398,708,709],{},"session.expiresAt",[398,711,712],{},"session.ipAddress",[398,714,715],{},"session.userAgent",").",[644,718,719,724,729,734],{},[665,720,721],{},[398,722,723],{},"fields",[665,725,726],{},[398,727,728],{},"string[]",[665,730,731],{},[398,732,733],{},"['id', 'name', 'email', 'image', 'emailVerified', 'createdAt']",[665,735,736],{},"User fields to extract.",[644,738,739,744,749,754],{},[665,740,741],{},[398,742,743],{},"extend",[665,745,746],{},[398,747,748],{},"(session) => Record\u003Cstring, unknown>",[665,750,751],{},[398,752,753],{},"undefined",[665,755,756],{},"Add custom fields from Better Auth plugins (organizations, roles, etc.).",[418,758,760],{"className":420,"code":759,"filename":422,"language":423,"meta":424,"style":424},"identifyUser(log, session, {\n  maskEmail: true,\n  fields: ['id', 'name'],\n  session: false,\n})\n",[398,761,762,778,792,823,835],{"__ignoreMap":424},[428,763,764,766,769,771,773,775],{"class":430,"line":431},[428,765,390],{"class":496},[428,767,768],{"class":442},"(log",[428,770,558],{"class":438},[428,772,561],{"class":442},[428,774,558],{"class":438},[428,776,777],{"class":438}," {\n",[428,779,780,783,785,789],{"class":430,"line":462},[428,781,782],{"class":506},"  maskEmail",[428,784,510],{"class":438},[428,786,788],{"class":787},"sfNiH"," true",[428,790,791],{"class":438},",\n",[428,793,794,797,799,802,804,807,809,811,813,816,818,821],{"class":430,"line":469},[428,795,796],{"class":506},"  fields",[428,798,510],{"class":438},[428,800,801],{"class":442}," [",[428,803,608],{"class":438},[428,805,806],{"class":455},"id",[428,808,608],{"class":438},[428,810,558],{"class":438},[428,812,452],{"class":438},[428,814,815],{"class":455},"name",[428,817,608],{"class":438},[428,819,820],{"class":442},"]",[428,822,791],{"class":438},[428,824,825,828,830,833],{"class":430,"line":527},[428,826,827],{"class":506},"  session",[428,829,510],{"class":438},[428,831,832],{"class":787}," false",[428,834,791],{"class":438},[428,836,837,839],{"class":430,"line":539},[428,838,521],{"class":438},[428,840,524],{"class":442},[634,842,844],{"id":843},"mask-emails","Mask emails",[395,846,847],{},"Emails are PII. In environments where the audit\u002Flog trail might be reviewed by support or third parties, mask them:",[418,849,851],{"className":420,"code":850,"language":423,"meta":424,"style":424},"identifyUser(log, session, { maskEmail: true })\n",[398,852,853],{"__ignoreMap":424},[428,854,855,857,859,861,863,865,867,870,872,874,876],{"class":430,"line":431},[428,856,390],{"class":496},[428,858,768],{"class":442},[428,860,558],{"class":438},[428,862,561],{"class":442},[428,864,558],{"class":438},[428,866,439],{"class":438},[428,868,869],{"class":506}," maskEmail",[428,871,510],{"class":438},[428,873,788],{"class":787},[428,875,446],{"class":438},[428,877,524],{"class":442},[395,879,880,881,883],{},"The ",[398,882,669],{}," helper is also exported on its own:",[418,885,887],{"className":420,"code":886,"language":423,"meta":424,"style":424},"import { maskEmail } from 'evlog\u002Fbetter-auth'\n\nmaskEmail('hugo@example.com') \u002F\u002F 'h***@example.com'\n",[398,888,889,907,911],{"__ignoreMap":424},[428,890,891,893,895,897,899,901,903,905],{"class":430,"line":431},[428,892,435],{"class":434},[428,894,439],{"class":438},[428,896,869],{"class":442},[428,898,446],{"class":438},[428,900,449],{"class":434},[428,902,452],{"class":438},[428,904,456],{"class":455},[428,906,459],{"class":438},[428,908,909],{"class":430,"line":462},[428,910,466],{"emptyLinePlaceholder":465},[428,912,913,915,917,919,922,924,926],{"class":430,"line":469},[428,914,669],{"class":496},[428,916,500],{"class":442},[428,918,608],{"class":438},[428,920,921],{"class":455},"hugo@example.com",[428,923,608],{"class":438},[428,925,578],{"class":442},[428,927,929],{"class":928},"sHwdD","\u002F\u002F 'h***@example.com'\n",[634,931,933],{"id":932},"capture-plugin-fields","Capture plugin fields",[395,935,936,937,939],{},"Better Auth ships with plugins (organizations, 2FA, roles, admin) that add fields to the session. Use ",[398,938,743],{}," to surface them on the wide event:",[418,941,944],{"className":420,"code":942,"filename":943,"language":423,"meta":424,"style":424},"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",[398,945,946,965,969,987,1009,1030,1050,1059],{"__ignoreMap":424},[428,947,948,950,952,955,957,959,961,963],{"class":430,"line":431},[428,949,435],{"class":434},[428,951,439],{"class":438},[428,953,954],{"class":442}," createAuthMiddleware",[428,956,446],{"class":438},[428,958,449],{"class":434},[428,960,452],{"class":438},[428,962,456],{"class":455},[428,964,459],{"class":438},[428,966,967],{"class":430,"line":462},[428,968,466],{"emptyLinePlaceholder":465},[428,970,971,973,976,978,980,983,985],{"class":430,"line":469},[428,972,473],{"class":472},[428,974,975],{"class":442}," identify ",[428,977,479],{"class":438},[428,979,954],{"class":496},[428,981,982],{"class":442},"(auth",[428,984,558],{"class":438},[428,986,777],{"class":438},[428,988,989,992,994,996,999,1002,1005,1007],{"class":430,"line":527},[428,990,991],{"class":496},"  extend",[428,993,510],{"class":438},[428,995,572],{"class":438},[428,997,691],{"class":998},"sHdIc",[428,1000,1001],{"class":438},")",[428,1003,1004],{"class":472}," =>",[428,1006,572],{"class":442},[428,1008,536],{"class":438},[428,1010,1011,1014,1016,1018,1020,1023,1025,1028],{"class":430,"line":539},[428,1012,1013],{"class":506},"    organization",[428,1015,510],{"class":438},[428,1017,561],{"class":442},[428,1019,488],{"class":438},[428,1021,1022],{"class":442},"user",[428,1024,488],{"class":438},[428,1026,1027],{"class":442},"activeOrganization",[428,1029,791],{"class":438},[428,1031,1032,1035,1037,1039,1041,1043,1045,1048],{"class":430,"line":566},[428,1033,1034],{"class":506},"    role",[428,1036,510],{"class":438},[428,1038,561],{"class":442},[428,1040,488],{"class":438},[428,1042,1022],{"class":442},[428,1044,488],{"class":438},[428,1046,1047],{"class":442},"role",[428,1049,791],{"class":438},[428,1051,1052,1055,1057],{"class":430,"line":583},[428,1053,1054],{"class":438},"  }",[428,1056,1001],{"class":442},[428,1058,791],{"class":438},[428,1060,1061,1063],{"class":430,"line":615},[428,1062,521],{"class":438},[428,1064,524],{"class":442},[395,1066,1067],{},"Wide event with plugin fields:",[418,1069,1074],{"className":1070,"code":1071,"filename":1072,"language":1073,"meta":424,"style":424},"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",[398,1075,1076,1080,1103,1150,1197,1215],{"__ignoreMap":424},[428,1077,1078],{"class":430,"line":431},[428,1079,536],{"class":438},[428,1081,1082,1085,1088,1091,1093,1096,1099,1101],{"class":430,"line":462},[428,1083,1084],{"class":438},"  \"",[428,1086,1087],{"class":472},"userId",[428,1089,1090],{"class":438},"\"",[428,1092,510],{"class":438},[428,1094,1095],{"class":438}," \"",[428,1097,1098],{"class":455},"QBX9tPjJQExWawAbNll75",[428,1100,1090],{"class":438},[428,1102,791],{"class":438},[428,1104,1105,1107,1109,1111,1113,1115,1117,1120,1122,1124,1126,1128,1130,1132,1134,1136,1138,1140,1142,1145,1147],{"class":430,"line":469},[428,1106,1084],{"class":438},[428,1108,1022],{"class":472},[428,1110,1090],{"class":438},[428,1112,510],{"class":438},[428,1114,439],{"class":438},[428,1116,1095],{"class":438},[428,1118,806],{"class":1119},"sBMFI",[428,1121,1090],{"class":438},[428,1123,510],{"class":438},[428,1125,1095],{"class":438},[428,1127,1098],{"class":455},[428,1129,1090],{"class":438},[428,1131,558],{"class":438},[428,1133,1095],{"class":438},[428,1135,815],{"class":1119},[428,1137,1090],{"class":438},[428,1139,510],{"class":438},[428,1141,1095],{"class":438},[428,1143,1144],{"class":455},"Hugo Richard",[428,1146,1090],{"class":438},[428,1148,1149],{"class":438}," },\n",[428,1151,1152,1154,1157,1159,1161,1163,1165,1167,1169,1171,1173,1176,1178,1180,1182,1184,1186,1188,1190,1193,1195],{"class":430,"line":527},[428,1153,1084],{"class":438},[428,1155,1156],{"class":472},"organization",[428,1158,1090],{"class":438},[428,1160,510],{"class":438},[428,1162,439],{"class":438},[428,1164,1095],{"class":438},[428,1166,806],{"class":1119},[428,1168,1090],{"class":438},[428,1170,510],{"class":438},[428,1172,1095],{"class":438},[428,1174,1175],{"class":455},"org_42",[428,1177,1090],{"class":438},[428,1179,558],{"class":438},[428,1181,1095],{"class":438},[428,1183,815],{"class":1119},[428,1185,1090],{"class":438},[428,1187,510],{"class":438},[428,1189,1095],{"class":438},[428,1191,1192],{"class":455},"Acme",[428,1194,1090],{"class":438},[428,1196,1149],{"class":438},[428,1198,1199,1201,1203,1205,1207,1209,1212],{"class":430,"line":539},[428,1200,1084],{"class":438},[428,1202,1047],{"class":472},[428,1204,1090],{"class":438},[428,1206,510],{"class":438},[428,1208,1095],{"class":438},[428,1210,1211],{"class":455},"admin",[428,1213,1214],{"class":438},"\"\n",[428,1216,1217],{"class":430,"line":566},[428,1218,624],{"class":438},[626,1220,1221,1222,1224],{},"Keep ",[398,1223,743],{}," 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.",[634,1226,1228],{"id":1227},"captured-fields","Captured fields",[638,1230,1231,1243],{},[641,1232,1233],{},[644,1234,1235,1238,1241],{},[647,1236,1237],{},"Field",[647,1239,1240],{},"Source",[647,1242,658],{},[660,1244,1245,1262,1276,1291,1309,1324,1339,1354,1368,1382,1396,1410,1425,1438],{},[644,1246,1247,1251,1256],{},[665,1248,1249],{},[398,1250,1087],{},[665,1252,1253],{},[398,1254,1255],{},"session.user.id",[665,1257,1258,1259,716],{},"Top-level user ID (used by PostHog adapter as ",[398,1260,1261],{},"distinct_id",[644,1263,1264,1269,1273],{},[665,1265,1266],{},[398,1267,1268],{},"user.id",[665,1270,1271],{},[398,1272,1255],{},[665,1274,1275],{},"User ID.",[644,1277,1278,1283,1288],{},[665,1279,1280],{},[398,1281,1282],{},"user.name",[665,1284,1285],{},[398,1286,1287],{},"session.user.name",[665,1289,1290],{},"Display name.",[644,1292,1293,1298,1303],{},[665,1294,1295],{},[398,1296,1297],{},"user.email",[665,1299,1300],{},[398,1301,1302],{},"session.user.email",[665,1304,1305,1306,716],{},"Email (maskable with ",[398,1307,1308],{},"maskEmail: true",[644,1310,1311,1316,1321],{},[665,1312,1313],{},[398,1314,1315],{},"user.image",[665,1317,1318],{},[398,1319,1320],{},"session.user.image",[665,1322,1323],{},"Avatar URL.",[644,1325,1326,1331,1336],{},[665,1327,1328],{},[398,1329,1330],{},"user.emailVerified",[665,1332,1333],{},[398,1334,1335],{},"session.user.emailVerified",[665,1337,1338],{},"Email verification status.",[644,1340,1341,1346,1351],{},[665,1342,1343],{},[398,1344,1345],{},"user.createdAt",[665,1347,1348],{},[398,1349,1350],{},"session.user.createdAt",[665,1352,1353],{},"Account creation date (ISO string).",[644,1355,1356,1360,1365],{},[665,1357,1358],{},[398,1359,705],{},[665,1361,1362],{},[398,1363,1364],{},"session.session.id",[665,1366,1367],{},"Session ID.",[644,1369,1370,1374,1379],{},[665,1371,1372],{},[398,1373,709],{},[665,1375,1376],{},[398,1377,1378],{},"session.session.expiresAt",[665,1380,1381],{},"Session expiry (ISO string).",[644,1383,1384,1388,1393],{},[665,1385,1386],{},[398,1387,712],{},[665,1389,1390],{},[398,1391,1392],{},"session.session.ipAddress",[665,1394,1395],{},"Client IP from the session.",[644,1397,1398,1402,1407],{},[665,1399,1400],{},[398,1401,715],{},[665,1403,1404],{},[398,1405,1406],{},"session.session.userAgent",[665,1408,1409],{},"User agent string from the session.",[644,1411,1412,1417,1422],{},[665,1413,1414],{},[398,1415,1416],{},"session.createdAt",[665,1418,1419],{},[398,1420,1421],{},"session.session.createdAt",[665,1423,1424],{},"Session creation date (ISO string).",[644,1426,1427,1432,1435],{},[665,1428,1429],{},[398,1430,1431],{},"auth.resolvedIn",[665,1433,1434],{},"Measured",[665,1436,1437],{},"Session resolution time in ms.",[644,1439,1440,1445,1448],{},[665,1441,1442],{},[398,1443,1444],{},"auth.identified",[665,1446,1447],{},"Computed",[665,1449,1450],{},"Whether the request was identified.",[1452,1453,1454],"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":424,"searchDepth":462,"depth":462,"links":1456},[1457,1458,1459,1460],{"id":636,"depth":462,"text":80},{"id":843,"depth":462,"text":844},{"id":932,"depth":462,"text":933},{"id":1227,"depth":462,"text":1228},"The core building block — extract safe user fields, mask emails, and capture plugin data (organizations, roles, 2FA) from a Better Auth session.","md",[1464,1467],{"label":41,"icon":44,"to":101,"color":1465,"variant":1466},"neutral","subtle",{"label":109,"icon":112,"to":110,"color":1465,"variant":1466},{},{"title":104,"icon":107},{"title":390,"description":1461},"aLBnBR6fcXnoAM8cRD5H5oS24yeog359MO51-UaOmQo",[1473,1475],{"title":41,"path":101,"stem":102,"description":1474,"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":109,"path":110,"stem":111,"description":1476,"icon":112,"children":-1},"Framework-agnostic factory with route filtering, session timing, and lifecycle hooks. Call it once at startup and reuse across requests.",1777911265644]