refactor(core): Support multiple log scopes (#11318)

This commit is contained in:
Iván Ovejero
2024-10-22 17:20:14 +02:00
committed by GitHub
parent c863abd083
commit 43f31b86aa
16 changed files with 55 additions and 37 deletions

View File

@@ -40,7 +40,7 @@ export class JobProcessor {
private readonly nodeTypes: NodeTypes,
private readonly instanceSettings: InstanceSettings,
) {
this.logger = this.logger.withScope('scaling');
this.logger = this.logger.scoped('scaling');
}
async processJob(job: Job): Promise<JobResult> {

View File

@@ -36,7 +36,7 @@ export class MultiMainSetup extends TypedEmitter<MultiMainEvents> {
private readonly globalConfig: GlobalConfig,
) {
super();
this.logger = this.logger.withScope('scaling');
this.logger = this.logger.scoped(['scaling', 'multi-main-setup']);
}
private leaderKey: string;

View File

@@ -26,7 +26,7 @@ export class Publisher {
// @TODO: Once this class is only ever initialized in scaling mode, throw in the next line instead.
if (config.getEnv('executions.mode') !== 'queue') return;
this.logger = this.logger.withScope('scaling');
this.logger = this.logger.scoped(['scaling', 'pubsub']);
this.client = this.redisClientService.createClient({ type: 'publisher(n8n)' });
}

View File

@@ -27,7 +27,7 @@ export class Subscriber {
// @TODO: Once this class is only ever initialized in scaling mode, throw in the next line instead.
if (config.getEnv('executions.mode') !== 'queue') return;
this.logger = this.logger.withScope('scaling');
this.logger = this.logger.scoped(['scaling', 'pubsub']);
this.client = this.redisClientService.createClient({ type: 'subscriber(n8n)' });

View File

@@ -51,7 +51,7 @@ export class ScalingService {
private readonly orchestrationService: OrchestrationService,
private readonly eventService: EventService,
) {
this.logger = this.logger.withScope('scaling');
this.logger = this.logger.scoped('scaling');
}
// #region Lifecycle

View File

@@ -58,7 +58,7 @@ export class WorkerServer {
) {
assert(this.instanceSettings.instanceType === 'worker');
this.logger = this.logger.withScope('scaling');
this.logger = this.logger.scoped('scaling');
this.app = express();