Skip to content

Commit

Permalink
fix(core): Fix logger error when logging circular json (#3583)
Browse files Browse the repository at this point in the history
* Fix logger error when logging circular json

* add type
  • Loading branch information
ahsanv authored Jun 23, 2022
1 parent 44b64fb commit 3cb693d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/cli/src/Logger.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 3cb693d

Please sign in to comment.