Socket
Socket
Sign inDemoInstall

@octokit/plugin-request-log

Package Overview
Dependencies
10
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @octokit/plugin-request-log

Log all requests and request errors


Version published
Weekly downloads
4.1M
decreased by-19.09%
Maintainers
4
Install size
5.67 kB
Created
Weekly downloads
 

Readme

Source

plugin-request-log.js

Log all requests and request errors

@latest Build Status

Usage

Browsers

Load @octokit/plugin-request-log and @octokit/core (or core-compatible module) directly from esm.sh

<script type="module">
  import { Octokit } from "https://esm.sh/@octokit/core";
  import { requestLog } from "https://esm.sh/@octokit/plugin-request-log";
</script>
Node

Install with npm install @octokit/core @octokit/plugin-request-log. Optionally replace @octokit/core with a core-compatible module

import { Octokit } from "@octokit/core";
import { requestLog } from "@octokit/plugin-request-log";

[!IMPORTANT] As we use conditional exports, you will need to adapt your tsconfig.json by setting "moduleResolution": "node16", "module": "node16".

See the TypeScript docs on package.json "exports".
See this helpful guide on transitioning to ESM from @sindresorhus

const MyOctokit = Octokit.plugin(requestLog);
const octokit = new MyOctokit({ auth: "secret123" });

octokit.request("GET /");
// logs "GET / - 200 in 123ms

octokit.request("GET /oops");
// logs "GET / - 404 in 123ms

In order to log all request options, the log.debug option needs to be set. We recommend the console-log-level package for a configurable log level

import consoleLogLevel from "console-log-level";
const octokit = new MyOctokit({
  log: consoleLogLevel({
    auth: "secret123",
    level: "info",
  }),
});

Contributing

See CONTRIBUTING.md

License

MIT

Keywords

FAQs

Last updated on 16 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc