Skip to content

Commit 08bf952

Browse files
committed
feat: octokit.log.{debug,info,warn,error}()
1 parent d4280ba commit 08bf952

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/index.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ export class Octokit {
7575

7676
this.request = request.defaults(requestDefaults);
7777
this.graphql = withCustomRequest(this.request).defaults(requestDefaults);
78+
this.log = Object.assign(
79+
{
80+
debug: () => {},
81+
info: () => {},
82+
warn: console.warn.bind(console),
83+
error: console.error.bind(console)
84+
},
85+
options.log
86+
);
7887
this.hook = hook;
7988

8089
// apply plugins
@@ -86,6 +95,13 @@ export class Octokit {
8695
// assigned during constructor
8796
request: typeof request;
8897
graphql: typeof graphql;
98+
log: {
99+
debug: (message: string, additionalInfo?: object) => any;
100+
info: (message: string, additionalInfo?: object) => any;
101+
warn: (message: string, additionalInfo?: object) => any;
102+
error: (message: string, additionalInfo?: object) => any;
103+
[key: string]: any;
104+
};
89105
hook: HookCollection;
90106

91107
// allow for plugins to extend the Octokit instance

0 commit comments

Comments
 (0)