const jsonReplacers = require('./json-replacers');
const dataSanitizers = require('./data-sanitizers');
-const nop = () => { /**/ };
+const nop = () => undefined;
class Logger {
/**
if (this.sanitizationNeeded(data)) {
// Create copy of data so we are not changing anything important.
- data = structuredClone(data);
+ try {
+ data = structuredClone(data);
+ } catch (e) {
+ data = JSON.parse(JSON.stringify(data, replacer));
+ }
this.sanitize(data);
}
while (ancestors.length > 0 && ancestors.at(-1) !== this) {
ancestors.pop();
}
- if (ancestors.includes(value)) { // eslint-disable-line security/detect-object-injection
+ if (ancestors.includes(value)) {
return '[Circular]';
} else {
ancestors.push(value);
}
return value;
- }
+ };
}
}