diff --git a/packages/better-auth/src/__snapshots__/init.test.ts.snap b/packages/better-auth/src/__snapshots__/init.test.ts.snap index 8450d514cd..046ee55c8e 100644 --- a/packages/better-auth/src/__snapshots__/init.test.ts.snap +++ b/packages/better-auth/src/__snapshots__/init.test.ts.snap @@ -15,13 +15,14 @@ exports[`init > should match config 1`] = ` "adapterConfig": { "adapterId": "kysely", "adapterName": "Kysely Adapter", - "debugLogs": undefined, + "debugLogs": false, "supportsBooleans": false, "supportsDates": false, "supportsJSON": false, "supportsNumericIds": true, "usePlural": undefined, }, + "debugLogs": false, "type": "sqlite", }, "update": [Function], diff --git a/packages/better-auth/src/db/utils.ts b/packages/better-auth/src/db/utils.ts index 13f8abeedd..dc99435672 100644 --- a/packages/better-auth/src/db/utils.ts +++ b/packages/better-auth/src/db/utils.ts @@ -30,6 +30,8 @@ export async function getAdapter(options: BetterAuthOptions): Promise { } return kyselyAdapter(kysely, { type: databaseType || "sqlite", + debugLogs: + "debugLogs" in options.database ? options.database.debugLogs : false, })(options); } diff --git a/packages/better-auth/src/types/options.ts b/packages/better-auth/src/types/options.ts index 269b0ef811..b815d2f30d 100644 --- a/packages/better-auth/src/types/options.ts +++ b/packages/better-auth/src/types/options.ts @@ -18,6 +18,7 @@ import type { Database } from "better-sqlite3"; import type { Logger } from "../utils"; import type { AuthMiddleware } from "../plugins"; import type { LiteralUnion, OmitId } from "./helper"; +import type { AdapterDebugLogs } from "../adapters"; //@ts-ignore - we need to import this to get the type of the database import type { Database as BunDatabase } from "bun:sqlite"; @@ -92,6 +93,12 @@ export type BetterAuthOptions = { * @default "camel" */ casing?: "snake" | "camel"; + /** + * Enable debug logs for the adapter + * + * @default false + */ + debugLogs?: AdapterDebugLogs; } | { /** @@ -108,6 +115,12 @@ export type BetterAuthOptions = { * @default "camel" */ casing?: "snake" | "camel"; + /** + * Enable debug logs for the adapter + * + * @default false + */ + debugLogs?: AdapterDebugLogs; }; /** * Secondary storage configuration