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