# @octokit/plugin-request-log

> Log all requests and request errors

Latest version **6.0.0** (published 2025-05-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @octokit/plugin-request-log
pnpm add @octokit/plugin-request-log
yarn add @octokit/plugin-request-log
bun add @octokit/plugin-request-log
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high maintenance score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 6.0.0 |
| Published | 2025-05-20 |
| First published | 2020-01-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >= 20 |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 7 |
| Author | Gregor Martynus |
| Maintainers | octokitbot |
| Keywords | github, api, sdk, toolkit |

## Links

- npm: https://www.npmjs.com/package/@octokit/plugin-request-log
- Repository: https://github.com/octokit/plugin-request-log.js
- Homepage: https://github.com/octokit/plugin-request-log.js#readme
- Issues: https://github.com/octokit/plugin-request-log.js/issues
- npm.io page: https://npm.io/package/@octokit/plugin-request-log

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 6.0.0 (latest) — 2025-05-20
- 5.3.1 — 2024-07-16
- 5.3.0 — 2024-06-05
- 5.2.0 — 2024-05-02
- 5.1.1 — 2024-04-16
- 5.1.0 — 2024-04-03
- 5.0.0 — 2024-03-05
- 4.0.1 — 2024-03-01
- 4.0.0 — 2023-07-10
- 3.0.0 — 2023-06-12
- 2.0.1 — 2023-06-09
- 1.0.4 — 2021-06-11
- 1.0.3 — 2021-01-25
- 1.0.2 — 2020-10-23
- 1.0.1 — 2020-10-22
- … 1 more at https://npm.io/package/@octokit/plugin-request-log/versions

## README

# plugin-request-log.js

> Log all requests and request errors

[![@latest](https://img.shields.io/npm/v/@octokit/plugin-request-log.svg)](https://www.npmjs.com/package/@octokit/plugin-request-log)
[![Build Status](https://github.com/octokit/plugin-request-log.js/workflows/Test/badge.svg)](https://github.com/octokit/plugin-request-log.js/actions?workflow=Test)

## Usage

<table>
<tbody valign=top align=left>
<tr><th>
Browsers
</th><td width=100%>

Load `@octokit/plugin-request-log` and [`@octokit/core`](https://github.com/octokit/core.js) (or core-compatible module) directly from [esm.sh](https://esm.sh)

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

</td></tr>
<tr><th>
Node
</th><td>

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

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

</td></tr>
</tbody>
</table>

> [!IMPORTANT]
> As we use [conditional exports](https://nodejs.org/api/packages.html#conditional-exports), you will need to adapt your `tsconfig.json` by setting `"moduleResolution": "node16", "module": "node16"`.
>
> See the TypeScript docs on [package.json "exports"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).<br>
> See this [helpful guide on transitioning to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) from [@sindresorhus](https://github.com/sindresorhus)

```js
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](https://github.com/watson/console-log-level) package for a configurable log level

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

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md)

## License

[MIT](LICENSE)

---
_Source: https://npm.io/package/@octokit/plugin-request-log · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
