@octokit/core
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -61,2 +61,8 @@ 'use strict'; | ||
this.graphql = graphql.withCustomRequest(this.request).defaults(requestDefaults); | ||
this.log = Object.assign({ | ||
debug: () => {}, | ||
info: () => {}, | ||
warn: console.warn.bind(console), | ||
error: console.error.bind(console) | ||
}, options.log); | ||
this.hook = hook; // apply plugins | ||
@@ -63,0 +69,0 @@ // https://stackoverflow.com/a/16345172 |
@@ -45,2 +45,8 @@ import { getUserAgent } from "universal-user-agent"; | ||
this.graphql = withCustomRequest(this.request).defaults(requestDefaults); | ||
this.log = Object.assign({ | ||
debug: () => { }, | ||
info: () => { }, | ||
warn: console.warn.bind(console), | ||
error: console.error.bind(console) | ||
}, options.log); | ||
this.hook = hook; | ||
@@ -47,0 +53,0 @@ // apply plugins |
@@ -11,2 +11,9 @@ import { HookCollection } from "before-after-hook"; | ||
graphql: import("@octokit/graphql/dist-types/types").graphql; | ||
log: { | ||
[key: string]: any; | ||
debug: (message: string, additionalInfo?: object | undefined) => any; | ||
info: (message: string, additionalInfo?: object | undefined) => any; | ||
warn: (message: string, additionalInfo?: object | undefined) => any; | ||
error: (message: string, additionalInfo?: object | undefined) => any; | ||
}; | ||
hook: HookCollection; | ||
@@ -21,2 +28,9 @@ }; | ||
graphql: import("@octokit/graphql/dist-types/types").graphql; | ||
log: { | ||
[key: string]: any; | ||
debug: (message: string, additionalInfo?: object | undefined) => any; | ||
info: (message: string, additionalInfo?: object | undefined) => any; | ||
warn: (message: string, additionalInfo?: object | undefined) => any; | ||
error: (message: string, additionalInfo?: object | undefined) => any; | ||
}; | ||
hook: HookCollection; | ||
@@ -35,2 +49,9 @@ }; | ||
graphql: import("@octokit/graphql/dist-types/types").graphql; | ||
log: { | ||
[key: string]: any; | ||
debug: (message: string, additionalInfo?: object | undefined) => any; | ||
info: (message: string, additionalInfo?: object | undefined) => any; | ||
warn: (message: string, additionalInfo?: object | undefined) => any; | ||
error: (message: string, additionalInfo?: object | undefined) => any; | ||
}; | ||
hook: HookCollection; | ||
@@ -44,2 +65,9 @@ }; | ||
graphql: import("@octokit/graphql/dist-types/types").graphql; | ||
log: { | ||
[key: string]: any; | ||
debug: (message: string, additionalInfo?: object | undefined) => any; | ||
info: (message: string, additionalInfo?: object | undefined) => any; | ||
warn: (message: string, additionalInfo?: object | undefined) => any; | ||
error: (message: string, additionalInfo?: object | undefined) => any; | ||
}; | ||
hook: HookCollection; | ||
@@ -56,4 +84,11 @@ }; | ||
graphql: typeof graphql; | ||
log: { | ||
debug: (message: string, additionalInfo?: object) => any; | ||
info: (message: string, additionalInfo?: object) => any; | ||
warn: (message: string, additionalInfo?: object) => any; | ||
error: (message: string, additionalInfo?: object) => any; | ||
[key: string]: any; | ||
}; | ||
hook: HookCollection; | ||
[key: string]: any; | ||
} |
@@ -57,2 +57,8 @@ import { getUserAgent } from 'universal-user-agent'; | ||
this.graphql = withCustomRequest(this.request).defaults(requestDefaults); | ||
this.log = Object.assign({ | ||
debug: () => { }, | ||
info: () => { }, | ||
warn: console.warn.bind(console), | ||
error: console.error.bind(console) | ||
}, options.log); | ||
this.hook = hook; | ||
@@ -59,0 +65,0 @@ // apply plugins |
{ | ||
"name": "@octokit/core", | ||
"description": "Extendable client for GitHub's REST & GraphQL APIs", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"license": "MIT", | ||
@@ -19,10 +19,3 @@ "files": [ | ||
], | ||
"homepage": "https://github.com/octokit/core.js#readme", | ||
"bugs": { | ||
"url": "https://github.com/octokit/core.js/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/octokit/core.js.git" | ||
}, | ||
"repository": "https://github.com/octokit/core.js", | ||
"dependencies": { | ||
@@ -29,0 +22,0 @@ "@octokit/graphql": "^4.2.0", |
# core.js | ||
> Extendable client for GitHub's REST & GraphQL APIs | ||
[![@latest](https://img.shields.io/npm/v/@octokit/core.svg)](https://www.npmjs.com/package/@octokit/core) | ||
@@ -7,4 +9,2 @@ [![Build Status](https://github.com/octokit/core.js/workflows/Test/badge.svg)](https://github.com/octokit/core.js/actions) | ||
> Extendable client for GitHub's REST & GraphQL APIs | ||
<!-- toc --> | ||
@@ -18,2 +18,3 @@ | ||
- [Authentication](#authentication) | ||
- [Logging](#logging) | ||
- [Hooks](#hooks) | ||
@@ -257,2 +258,23 @@ - [Plugins](#plugins) | ||
## Logging | ||
There are four built-in log methods | ||
1. `octokit.log.debug(message[, additionalInfo])` | ||
1. `octokit.log.info(message[, additionalInfo])` | ||
1. `octokit.log.warn(message[, additionalInfo])` | ||
1. `octokit.log.error(message[, additionalInfo])` | ||
They can be configured using the [`log` client option](client-options). By default, `octokit.log.debug()` and `octokit.log.info()` are no-ops, while the other two call `console.warn()` and `console.error()` respectively. | ||
This is useful if you build reusable [plugins](#plugins). | ||
If you would like to make the log level configurable using an environment variable or external option, we recommend the [console-log-level](https://github.com/watson/console-log-level) package. Example | ||
```js | ||
const octokit = new Octokit({ | ||
log: require("console-log-level")({ level: "info" }) | ||
}); | ||
``` | ||
## Hooks | ||
@@ -259,0 +281,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42533
451
344
2
1
1