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