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