Skip to content

Commit

Permalink
Merge pull request #1262 from contentstack/fix/logger-fix
Browse files Browse the repository at this point in the history
Fix: logger utility fix
  • Loading branch information
antonyagustine authored Jan 24, 2024
2 parents 73e1087 + 35459db commit b7418d5
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packages/contentstack-utilities/src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export default class Logger {
* the sensitiveKeys array, and false otherwise.
*/
isSensitiveKey(keyStr: string) {
if (keyStr) {
if (keyStr && typeof keyStr === 'string') {
return this.sensitiveKeys.some((regex) => regex.test(keyStr));
}
}
Expand Down Expand Up @@ -235,13 +235,17 @@ export default class Logger {
* redacted.
*/
redact(obj: any) {
const copy = klona(obj);
this.redactObject(copy);
try {
const copy = klona(obj);
this.redactObject(copy);

const splat = copy[Symbol.for('splat')];
this.redactObject(splat);
const splat = copy[Symbol.for('splat')];
this.redactObject(splat);

return copy;
return copy;
} catch (error) {
return obj;
}
}

/**
Expand Down

0 comments on commit b7418d5

Please sign in to comment.