Add LOG_LEVEL logger helper with createLogger() utility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 19:25:44 -05:00
co-authored by Claude Opus 4.6
parent 8d4628bb94
commit eb836eb2c7
10 changed files with 84 additions and 18 deletions
+12
View File
@@ -9,6 +9,7 @@ import {
isPasswordLoginDisabled,
} from "@/lib/config";
import { db } from "@/lib/db/client";
import { createLogger } from "@/lib/logger";
import {
getUserCount,
isRegistrationOpen,
@@ -36,7 +37,18 @@ const oidcPlugin = isOidcConfigured()
]
: [];
const authLog = createLogger("auth");
export const auth = betterAuth({
logger: {
// Suppress unset secret/low entropy warnings during build
disabled: process.env.NEXT_PHASE === "phase-production-build",
level: "debug",
log: (level, message, ...args) => {
const fn = authLog[level as keyof typeof authLog];
if (fn) fn(message, ...args);
},
},
database: drizzleAdapter(db, {
provider: "sqlite",
}),