Initial commit (from f5274cbdce4ae7c9e4b937dcdf95ac70ae436d5f)

This commit is contained in:
anaarmas 2020-04-28 16:46:47 +02:00
commit 28ccc3db2d
13974 changed files with 2618436 additions and 0 deletions

View file

@ -0,0 +1,24 @@
import { VERSION } from "./version";
/**
* @param octokit Octokit instance
* @param options Options passed to Octokit constructor
*/
export 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 => {
octokit.log.info(`${requestOptions.method} ${path} - ${response.status} in ${Date.now() - start}ms`);
return response;
})
.catch(error => {
octokit.log.info(`${requestOptions.method} ${path} - ${error.status} in ${Date.now() -
start}ms`);
throw error;
});
});
}
requestLog.VERSION = VERSION;

View file

@ -0,0 +1 @@
export const VERSION = "1.0.0";