diff options
Diffstat (limited to 'source/github-helpers/api.ts')
-rw-r--r-- | source/github-helpers/api.ts | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/source/github-helpers/api.ts b/source/github-helpers/api.ts index 45860893..17937968 100644 --- a/source/github-helpers/api.ts +++ b/source/github-helpers/api.ts @@ -29,6 +29,7 @@ import mem from 'mem'; import * as pageDetect from 'github-url-detection'; import {JsonObject, AsyncReturnType} from 'type-fest'; +import features from '../features'; import {getRepo} from '.'; import optionsStorage from '../options-storage'; @@ -48,13 +49,6 @@ interface RestResponse extends AnyObject { ok: boolean; } -export async function log(message: string): Promise<void> { - const {logAPI} = (await optionsStorage.getAll()); - if (logAPI) { - console.log(message); - } -} - export const escapeKey = (value: string | number): string => '_' + String(value).replace(/[ ./-]/g, '_'); export class RefinedGitHubAPIError extends Error { @@ -125,7 +119,7 @@ export const v3 = mem(async ( } const url = new URL(query, api3); - void log(String(url)); + features.log.http(url); const response = await fetch(url.href, { method, body: body && JSON.stringify(body), @@ -182,7 +176,7 @@ export const v4 = mem(async ( query = query.replace('repository() {', () => `repository(owner: "${getRepo()!.owner}", name: "${getRepo()!.name}") {`); - void log(`{ + features.log.http(`{ ${query} }`); |