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 317916e commit 06900f0Copy full SHA for 06900f0
src/index.ts
@@ -41,12 +41,17 @@ export function createAppAuth(options: StrategyOptions): AuthInterface {
41
);
42
}
43
44
- const log = Object.assign(
45
- {
46
- warn: console.warn.bind(console),
47
- },
48
- options.log,
49
- );
+ /**
+ * 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.
+ */
50
+ const log = options.log || ({} as NonNullable<StrategyOptions["log"]>);
51
+ if (typeof log.warn !== "function") {
52
+ log.warn = console.warn.bind(console);
53
+ }
54
+
55
const request =
56
options.request ||
57
defaultRequest.defaults({
0 commit comments