diff --git a/src/BaseLogger.ts b/src/BaseLogger.ts index 4a8a262..b426bd5 100644 --- a/src/BaseLogger.ts +++ b/src/BaseLogger.ts @@ -216,7 +216,7 @@ export class BaseLogger { : ((source: T): T => { // mask regEx this.settings?.maskValuesRegEx?.forEach((regEx) => { - source = (source as string).replace(regEx, this.settings.maskPlaceholder) as T; + source = (source as string)?.replace(regEx, this.settings.maskPlaceholder) as T; }); return source; })(source);