refactor(core): Make Logger a service (no-changelog) (#7494)
This commit is contained in:
committed by
GitHub
parent
db4e61ba24
commit
05586a900d
@@ -8,10 +8,8 @@ import config from '@/config';
|
||||
import { inTest } from '@/constants';
|
||||
import type { BaseMigration, Migration, MigrationContext, MigrationFn } from '@db/types';
|
||||
import { createSchemaBuilder } from '@db/dsl';
|
||||
import { getLogger } from '@/Logger';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
|
||||
const logger = getLogger();
|
||||
import { Logger } from '@/Logger';
|
||||
|
||||
const PERSONALIZATION_SURVEY_FILENAME = 'personalizationSurvey.json';
|
||||
|
||||
@@ -48,6 +46,7 @@ let runningMigrations = false;
|
||||
function logMigrationStart(migrationName: string): void {
|
||||
if (inTest) return;
|
||||
|
||||
const logger = Container.get(Logger);
|
||||
if (!runningMigrations) {
|
||||
logger.warn('Migrations in progress, please do NOT stop the process.');
|
||||
runningMigrations = true;
|
||||
@@ -59,6 +58,7 @@ function logMigrationStart(migrationName: string): void {
|
||||
function logMigrationEnd(migrationName: string): void {
|
||||
if (inTest) return;
|
||||
|
||||
const logger = Container.get(Logger);
|
||||
logger.debug(`Finished migration ${migrationName}`);
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ const dbName = config.getEnv(`database.${dbType === 'mariadb' ? 'mysqldb' : dbTy
|
||||
const tablePrefix = config.getEnv('database.tablePrefix');
|
||||
|
||||
const createContext = (queryRunner: QueryRunner, migration: Migration): MigrationContext => ({
|
||||
logger,
|
||||
logger: Container.get(Logger),
|
||||
tablePrefix,
|
||||
dbType,
|
||||
isMysql,
|
||||
|
||||
Reference in New Issue
Block a user