fix(core): Fix logger error when logging circular json (#3583)

* Fix logger error when logging circular json

* add type
This commit is contained in:
Ahsan Virani 2022-06-23 16:05:20 +02:00 committed by GitHub
parent 44b64fb683
commit 3cb693d5d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-shadow */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { inspect } from 'util';
import winston from 'winston';
import { IDataObject, ILogger, LogTypes } from 'n8n-workflow';
@ -36,12 +37,12 @@ class Logger implements ILogger {
winston.format.printf(({ level, message, timestamp, metadata }) => {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
return `${timestamp} | ${level.padEnd(18)} | ${message}${
Object.keys(metadata).length ? ` ${JSON.stringify(metadata)}` : ''
Object.keys(metadata).length ? ` ${JSON.stringify(inspect(metadata))}` : ''
}`;
}),
);
} else {
format = winston.format.printf(({ message }) => message);
format = winston.format.printf(({ message }: { message: string }) => message);
}
this.logger.add(