mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
fix(core): Fix logger error when logging circular json (#3583)
* Fix logger error when logging circular json * add type
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-shadow */
|
/* eslint-disable @typescript-eslint/no-shadow */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||||
|
import { inspect } from 'util';
|
||||||
import winston from 'winston';
|
import winston from 'winston';
|
||||||
|
|
||||||
import { IDataObject, ILogger, LogTypes } from 'n8n-workflow';
|
import { IDataObject, ILogger, LogTypes } from 'n8n-workflow';
|
||||||
@@ -36,12 +37,12 @@ class Logger implements ILogger {
|
|||||||
winston.format.printf(({ level, message, timestamp, metadata }) => {
|
winston.format.printf(({ level, message, timestamp, metadata }) => {
|
||||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||||
return `${timestamp} | ${level.padEnd(18)} | ${message}${
|
return `${timestamp} | ${level.padEnd(18)} | ${message}${
|
||||||
Object.keys(metadata).length ? ` ${JSON.stringify(metadata)}` : ''
|
Object.keys(metadata).length ? ` ${JSON.stringify(inspect(metadata))}` : ''
|
||||||
}`;
|
}`;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
format = winston.format.printf(({ message }) => message);
|
format = winston.format.printf(({ message }: { message: string }) => message);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.add(
|
this.logger.add(
|
||||||
|
|||||||
Reference in New Issue
Block a user