refactor: Verbeter logging
This commit is contained in:
parent
a1635b9db4
commit
f8035099c9
3 changed files with 15 additions and 6 deletions
|
@ -7,12 +7,17 @@ let orm: MikroORM | undefined;
|
|||
export async function initORM(testingMode = false): Promise<MikroORM<IDatabaseDriver, EntityManager>> {
|
||||
const logger: Logger = getLogger();
|
||||
|
||||
logger.info('Initializing ORM');
|
||||
logger.debug('MikroORM config is', config);
|
||||
const options = config(testingMode);
|
||||
|
||||
logger.info('MikroORM config is', options);
|
||||
|
||||
logger.info('Initializing ORM');
|
||||
orm = await MikroORM.init(options);
|
||||
logger.info('MikroORM initialized');
|
||||
|
||||
orm = await MikroORM.init(config(testingMode));
|
||||
// Update the database scheme if necessary and enabled.
|
||||
if (getEnvVar(envVars.DbUpdate)) {
|
||||
logger.info("MikroORM: Updating database schema");
|
||||
await orm.schema.updateSchema();
|
||||
} else {
|
||||
const diff = await orm.schema.getUpdateSchemaSQL();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue