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