Skip to content

Commit b8c22d1

Browse files
committed
Fix #123
1 parent 95d441e commit b8c22d1

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

src/LoggerWithoutCallSite.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,10 @@ export class LoggerWithoutCallSite {
679679
} else {
680680
std.write(
681681
typeStr +
682-
this._formatAndHideSensitive(argument) +
682+
this._formatAndHideSensitive(
683+
argument,
684+
this.settings.prettyInspectOptions
685+
) +
683686
this.settings.delimiter
684687
);
685688
}
@@ -713,7 +716,8 @@ export class LoggerWithoutCallSite {
713716
) +
714717
(errorObject.message != null
715718
? `${this.settings.delimiter}${this._formatAndHideSensitive(
716-
errorObject.message
719+
errorObject.message,
720+
this.settings.prettyInspectOptions
717721
)}`
718722
: "")
719723
);
@@ -879,7 +883,8 @@ export class LoggerWithoutCallSite {
879883
...errorObject,
880884
nativeError: undefined,
881885
errorString: this._formatAndHideSensitive(
882-
errorObject.nativeError
886+
errorObject.nativeError,
887+
this.settings.jsonInspectOptions
883888
),
884889
} as IErrorObjectStringifiable;
885890
} else if (typeof argument === "object") {
@@ -888,7 +893,10 @@ export class LoggerWithoutCallSite {
888893
this.settings.jsonInspectOptions
889894
);
890895
} else {
891-
return this._formatAndHideSensitive(argument);
896+
return this._formatAndHideSensitive(
897+
argument,
898+
this.settings.jsonInspectOptions
899+
);
892900
}
893901
}
894902
),
@@ -901,29 +909,26 @@ export class LoggerWithoutCallSite {
901909

902910
private _inspectAndHideSensitive(
903911
object: object | null,
904-
options: InspectOptions
912+
inspectOptions: InspectOptions
905913
): string {
906914
let formatted;
907915
try {
908916
const maskedObject = this._maskValuesOfKeys(object);
909-
formatted = inspect(maskedObject, options);
917+
formatted = inspect(maskedObject, inspectOptions);
910918
} catch {
911-
formatted = inspect(object, options);
919+
formatted = inspect(object, inspectOptions);
912920
}
913921

914922
return this._maskAny(formatted);
915923
}
916924

917925
private _formatAndHideSensitive(
918926
formatParam: unknown,
927+
inspectOptions: InspectOptions,
919928
...param: unknown[]
920929
): string {
921930
return this._maskAny(
922-
formatWithOptions(
923-
this.settings.prettyInspectOptions,
924-
formatParam,
925-
...param
926-
)
931+
formatWithOptions(inspectOptions, formatParam, ...param)
927932
);
928933
}
929934

0 commit comments

Comments
 (0)