mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(core): Make Logger a service (no-changelog) (#7494)
This commit is contained in:
committed by
GitHub
parent
db4e61ba24
commit
05586a900d
@@ -17,7 +17,6 @@ import type {
|
||||
IDataObject,
|
||||
IExecuteResponsePromiseData,
|
||||
IExecuteWorkflowInfo,
|
||||
ILogger,
|
||||
INode,
|
||||
INodeExecutionData,
|
||||
IRun,
|
||||
@@ -30,7 +29,6 @@ import type {
|
||||
} from 'n8n-workflow';
|
||||
import {
|
||||
ErrorReporterProxy as ErrorReporter,
|
||||
LoggerProxy,
|
||||
Workflow,
|
||||
WorkflowHooks,
|
||||
WorkflowOperationError,
|
||||
@@ -46,7 +44,7 @@ import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials';
|
||||
import * as WebhookHelpers from '@/WebhookHelpers';
|
||||
import * as WorkflowHelpers from '@/WorkflowHelpers';
|
||||
import * as WorkflowExecuteAdditionalData from '@/WorkflowExecuteAdditionalData';
|
||||
import { getLogger } from '@/Logger';
|
||||
import { Logger } from '@/Logger';
|
||||
|
||||
import config from '@/config';
|
||||
import { generateFailedExecutionFromError } from '@/WorkflowHelpers';
|
||||
@@ -63,7 +61,7 @@ if (process.env.NODEJS_PREFER_IPV4 === 'true') {
|
||||
class WorkflowRunnerProcess {
|
||||
data: IWorkflowExecutionDataProcessWithExecution | undefined;
|
||||
|
||||
logger: ILogger;
|
||||
logger: Logger;
|
||||
|
||||
startedAt = new Date();
|
||||
|
||||
@@ -85,19 +83,20 @@ class WorkflowRunnerProcess {
|
||||
}, 30000);
|
||||
}
|
||||
|
||||
constructor() {
|
||||
this.logger = Container.get(Logger);
|
||||
}
|
||||
|
||||
async runWorkflow(inputData: IWorkflowExecutionDataProcessWithExecution): Promise<IRun> {
|
||||
process.once('SIGTERM', WorkflowRunnerProcess.stopProcess);
|
||||
process.once('SIGINT', WorkflowRunnerProcess.stopProcess);
|
||||
|
||||
await initErrorHandling();
|
||||
|
||||
const logger = (this.logger = getLogger());
|
||||
LoggerProxy.init(logger);
|
||||
|
||||
this.data = inputData;
|
||||
const { userId } = inputData;
|
||||
|
||||
logger.verbose('Initializing n8n sub-process', {
|
||||
this.logger.verbose('Initializing n8n sub-process', {
|
||||
pid: process.pid,
|
||||
workflowId: this.data.workflowData.id,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user