first commit
This commit is contained in:
26
node_modules/@octokit/plugin-request-log/dist-src/index.js
generated
vendored
Normal file
26
node_modules/@octokit/plugin-request-log/dist-src/index.js
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { VERSION } from "./version.js";
|
||||
function requestLog(octokit) {
|
||||
octokit.hook.wrap("request", (request, options) => {
|
||||
octokit.log.debug("request", options);
|
||||
const start = Date.now();
|
||||
const requestOptions = octokit.request.endpoint.parse(options);
|
||||
const path = requestOptions.url.replace(options.baseUrl, "");
|
||||
return request(options).then((response) => {
|
||||
const requestId = response.headers["x-github-request-id"];
|
||||
octokit.log.info(
|
||||
`${requestOptions.method} ${path} - ${response.status} with id ${requestId} in ${Date.now() - start}ms`
|
||||
);
|
||||
return response;
|
||||
}).catch((error) => {
|
||||
const requestId = error.response?.headers["x-github-request-id"] || "UNKNOWN";
|
||||
octokit.log.error(
|
||||
`${requestOptions.method} ${path} - ${error.status} with id ${requestId} in ${Date.now() - start}ms`
|
||||
);
|
||||
throw error;
|
||||
});
|
||||
});
|
||||
}
|
||||
requestLog.VERSION = VERSION;
|
||||
export {
|
||||
requestLog
|
||||
};
|
||||
4
node_modules/@octokit/plugin-request-log/dist-src/version.js
generated
vendored
Normal file
4
node_modules/@octokit/plugin-request-log/dist-src/version.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
const VERSION = "6.0.0";
|
||||
export {
|
||||
VERSION
|
||||
};
|
||||
Reference in New Issue
Block a user