feat: kysely detail logs on error

This commit is contained in:
monoid 2024-11-07 05:18:01 +09:00
parent 67466b4968
commit 05c59937e9

View File

@ -22,6 +22,16 @@ export function getKysely() {
kysely = new Kysely<DB>({ kysely = new Kysely<DB>({
dialect: createSqliteDialect(), dialect: createSqliteDialect(),
// plugins: [new ParseJSONResultsPlugin()], // plugins: [new ParseJSONResultsPlugin()],
log: (event) => {
if (event.level === "error") {
console.error("Query failed : ", {
durationMs: event.queryDurationMillis,
error: event.error,
sql: event.query.sql,
params: event.query.parameters,
});
}
}
}); });
} }
return kysely; return kysely;