Add option to enable MikroORM database debug logging

This commit is contained in:
William Oldham
2023-11-18 19:21:02 +00:00
parent 6f48b62275
commit 8e10eb7d59
3 changed files with 14 additions and 3 deletions

View File

@@ -16,9 +16,14 @@ export function makeOrmConfig(url: string): Options<PostgreSqlDriver> {
};
}
export async function createORM(url: string, log: (msg: string) => void) {
export async function createORM(
url: string,
debug: boolean,
log: (msg: string) => void,
) {
return await MikroORM.init<PostgreSqlDriver>({
...makeOrmConfig(url),
logger: log,
debug,
});
}