Skip to content

Commit 8e5d264

Browse files
authored
Merge pull request #977 from scramjetorg/fix/logger-circular
Fix logging circular args
2 parents 167133d + 418a443 commit 8e5d264

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/obj-logger/src/obj-logger.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ export class ObjLogger implements IObjectLogger {
122122
let paramsCopy;
123123

124124
if (optionalParams.length) {
125-
paramsCopy = JSON.parse(JSON.stringify(optionalParams));
125+
try {
126+
paramsCopy = JSON.parse(JSON.stringify(optionalParams));
127+
} catch {
128+
paramsCopy = JSON.parse(JSON.stringify(optionalParams, getCircularReplacer()));
129+
}
126130
}
127131

128132
if (typeof entry === "string") {

0 commit comments

Comments
 (0)