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,7 +22,17 @@ export function getKysely() {
kysely = new Kysely<DB>({
dialect: createSqliteDialect(),
// 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;
}
}