Skip to content

Commit

Permalink
chore: remove error log
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Jan 10, 2025
1 parent 1f2e7ee commit 3b18be2
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions src/github/github-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,28 @@ const defaultOptions = {
},
};

function requestLogging(octokit: Octokit) {
octokit.hook.error("request", (error, options) => {
if ("status" in error) {
const { method, url, body } = octokit.request.endpoint.parse(options);
const msg = `GitHub request: ${method} ${url} - ${error.status}`;
// function requestLogging(octokit: Octokit) {
// octokit.hook.error("request", (error, options) => {
// if ("status" in error) {
// const { method, url, body } = octokit.request.endpoint.parse(options);
// const msg = `GitHub request: ${method} ${url} - ${error.status}`;
//
// // @ts-expect-error log.debug is a pino log method and accepts a fields object
// octokit.log.debug(body || {}, msg);
// }
//
// throw error;
// });
//
// octokit.hook.after("request", (result, options) => {
// const { method, url, body } = octokit.request.endpoint.parse(options);
// const msg = `GitHub request: ${method} ${url} - ${result.status}`;
//
// // @ts-expect-error log.debug is a pino log method and accepts a fields object
// octokit.log.debug(body || {}, msg);
// });
// }

// @ts-expect-error log.debug is a pino log method and accepts a fields object
octokit.log.debug(body || {}, msg);
}

throw error;
});

octokit.hook.after("request", (result, options) => {
const { method, url, body } = octokit.request.endpoint.parse(options);
const msg = `GitHub request: ${method} ${url} - ${result.status}`;

// @ts-expect-error log.debug is a pino log method and accepts a fields object
octokit.log.debug(body || {}, msg);
});
}

export const customOctokit = Octokit.plugin(throttling, retry, paginateRest, restEndpointMethods, requestLogging, requestLog).defaults(
(instanceOptions: object) => {
return Object.assign({}, defaultOptions, instanceOptions);
}
);
export const customOctokit = Octokit.plugin(throttling, retry, paginateRest, restEndpointMethods, requestLog).defaults((instanceOptions: object) => {
return Object.assign({}, defaultOptions, instanceOptions);
});

0 comments on commit 3b18be2

Please sign in to comment.