Packages

@octokit/rest

22.0.1 · 31 Oct 2025MIT27.9M / weekRepositoryHomepagenpmAtom feed

Your version

16.14.0

31 Jan 2019Where it was published

16.43.2 is the newest release of 16.x.

In short

5 new

Release note

Features

  • Custom logging

This release adds 4 new methods

  1. octokit.log.debug()

  2. octokit.log.info()

  3. octokit.log.warn()

  4. octokit.log.error()

They can be configured using the log client option. By default, octokit.log.debug() and octokit.log.info() are no-ops, while the other two call console.warn() and console.error() respectively.

This can be used for debugging. The simplest way is to set the log option to console

const octokit = require("@octokit/rest")({
  log: console
})

console.request("/")

This will log

request { method: "GET",
  baseUrl: "https://api.github.com",
  headers:
   { accept: "application/vnd.github.v3+json",
     "user-agent":
      "octokit.js/0.0.0-semantically-released Node.js/10.15.0 (macOS Mojave; x64)" },
  request: {},
  url: "/" }
GET / - 200 in 514ms

If you like to support a configurable log level, we recommend using the console-log-level module

const octokit = require("@octokit/rest")({
  log: require("console-log-level")({ level: "info" })
})

console.request("/")

This will only log

GET / - 200 in 514ms

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.