From d50c2fd2761efe12fbc34400817aa58fc4f97057 Mon Sep 17 00:00:00 2001 From: einhornimmond Date: Wed, 18 Jun 2025 09:40:46 +0200 Subject: [PATCH] use inspect instead of json.serialize for raw objects to prevent errors with circular objects --- config-schema/src/log4js-config/coloredContext.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config-schema/src/log4js-config/coloredContext.ts b/config-schema/src/log4js-config/coloredContext.ts index f8be6b003..1ebb6b219 100644 --- a/config-schema/src/log4js-config/coloredContext.ts +++ b/config-schema/src/log4js-config/coloredContext.ts @@ -1,6 +1,7 @@ import { Level, LoggingEvent } from 'log4js' import colors from 'yoctocolors-cjs' import { ColoredContextLayoutConfig, LogLevel } from './types' +import { inspect } from 'node:util' function colorize(str: string, level: Level): string { switch (level.colour) { @@ -33,7 +34,7 @@ function composeDataString(data: (string | Object)[]): string { .map((d) => { // if it is a object and his toString function return only garbage if (typeof d === 'object' && d.toString() === '[object Object]') { - return JSON.stringify(d) + return inspect(d, ) } if (d) { return d.toString()