Skip to content

Commit

Permalink
Fix #123
Browse files Browse the repository at this point in the history
  • Loading branch information
terehov committed Nov 29, 2021
1 parent 95d441e commit b8c22d1
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/LoggerWithoutCallSite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,10 @@ export class LoggerWithoutCallSite {
} else {
std.write(
typeStr +
this._formatAndHideSensitive(argument) +
this._formatAndHideSensitive(
argument,
this.settings.prettyInspectOptions
) +
this.settings.delimiter
);
}
Expand Down Expand Up @@ -713,7 +716,8 @@ export class LoggerWithoutCallSite {
) +
(errorObject.message != null
? `${this.settings.delimiter}${this._formatAndHideSensitive(
errorObject.message
errorObject.message,
this.settings.prettyInspectOptions
)}`
: "")
);
Expand Down Expand Up @@ -879,7 +883,8 @@ export class LoggerWithoutCallSite {
...errorObject,
nativeError: undefined,
errorString: this._formatAndHideSensitive(
errorObject.nativeError
errorObject.nativeError,
this.settings.jsonInspectOptions
),
} as IErrorObjectStringifiable;
} else if (typeof argument === "object") {
Expand All @@ -888,7 +893,10 @@ export class LoggerWithoutCallSite {
this.settings.jsonInspectOptions
);
} else {
return this._formatAndHideSensitive(argument);
return this._formatAndHideSensitive(
argument,
this.settings.jsonInspectOptions
);
}
}
),
Expand All @@ -901,29 +909,26 @@ export class LoggerWithoutCallSite {

private _inspectAndHideSensitive(
object: object | null,
options: InspectOptions
inspectOptions: InspectOptions
): string {
let formatted;
try {
const maskedObject = this._maskValuesOfKeys(object);
formatted = inspect(maskedObject, options);
formatted = inspect(maskedObject, inspectOptions);
} catch {
formatted = inspect(object, options);
formatted = inspect(object, inspectOptions);
}

return this._maskAny(formatted);
}

private _formatAndHideSensitive(
formatParam: unknown,
inspectOptions: InspectOptions,
...param: unknown[]
): string {
return this._maskAny(
formatWithOptions(
this.settings.prettyInspectOptions,
formatParam,
...param
)
formatWithOptions(inspectOptions, formatParam, ...param)
);
}

Expand Down

0 comments on commit b8c22d1

Please sign in to comment.