We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 49e6fed commit 1564400Copy full SHA for 1564400
src/index.ts
@@ -45,12 +45,17 @@ export function createAppAuth(options: StrategyOptions): AuthInterface {
45
);
46
}
47
48
- const log = Object.assign(
49
- {
50
- warn: console.warn.bind(console),
51
- },
52
- options.log,
53
- );
+ /**
+ * Mutate the logger to ensure it has a `warn` method.
+ *
+ * Some Loggers like pino need that the `this` reference points
+ * to the original object, so we cannot use `Object.assign` here.
+ */
54
+ const log = options.log || ({} as NonNullable<StrategyOptions["log"]>);
55
+ if (typeof log.warn !== "function") {
56
+ log.warn = console.warn.bind(console);
57
+ }
58
+
59
const request =
60
options.request ||
61
defaultRequest.defaults({
0 commit comments