feat: kysely detail logs on error
This commit is contained in:
parent
67466b4968
commit
05c59937e9
@ -22,7 +22,17 @@ 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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user