defined logger caller

This commit is contained in:
Jan Prochazka
2023-01-21 17:49:16 +01:00
parent 4d93be61b5
commit cc0f05168d
40 changed files with 46 additions and 41 deletions

View File

@@ -5,7 +5,7 @@ import _pick from 'lodash/pick';
import _compact from 'lodash/compact';
import { getLogger } from './getLogger';
const logger = getLogger();
const logger = getLogger('dbAnalyser');
const STRUCTURE_FIELDS = ['tables', 'collections', 'views', 'matviews', 'functions', 'procedures', 'triggers'];

View File

@@ -13,7 +13,7 @@ import { getLogger } from './getLogger';
import { SqlDumper } from './SqlDumper';
import { extendDatabaseInfo } from './structureTools';
const logger = getLogger();
const logger = getLogger('sqlGenerator');
interface SqlGeneratorOptions {
dropTables: boolean;

View File

@@ -2,7 +2,7 @@ import _intersection from 'lodash/intersection';
import { getLogger } from './getLogger';
import { prepareTableForImport } from './tableTransforms';
const logger = getLogger();
const logger = getLogger('bulkStreamBase');
export function createBulkInsertStreamBase(driver, stream, pool, name, options): any {
const fullNameQuoted = name.schemaName

View File

@@ -7,6 +7,10 @@ export function setLogger(value: Logger) {
_logger = value;
}
export function getLogger(): Logger {
return _logger || defaultLogger;
export function getLogger(caller?: string): Logger {
let res = _logger || defaultLogger;
if (caller) {
res = res.child({ caller });
}
return res;
}