# axios-debug-log

> Axios interceptor of logging requests & responses by debug.

Latest version **1.0.0** (published 2022-11-15) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install axios-debug-log
pnpm add axios-debug-log
yarn add axios-debug-log
bun add axios-debug-log
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-11-15 |
| First published | 2017-02-02 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 132 |
| Author | George Cheng |
| Maintainers | gerhut |
| Keywords | axios, debug, logging |

## Links

- npm: https://www.npmjs.com/package/axios-debug-log
- Repository: https://github.com/Gerhut/axios-debug-log
- Homepage: https://github.com/Gerhut/axios-debug-log#readme
- Issues: https://github.com/Gerhut/axios-debug-log/issues
- npm.io page: https://npm.io/package/axios-debug-log

## Dependencies (2)

- [debug](https://npm.io/package/debug.md) ^4.0.0
- [@types/debug](https://npm.io/package/@types/debug.md) ^4.0.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2022-11-15
- 0.8.4 — 2021-08-02
- 0.8.3 — 2021-07-14
- 0.8.2 — 2020-11-02
- 0.8.1 — 2020-11-02
- 0.8.0 — 2020-07-03
- 0.7.0 — 2020-03-10
- 0.6.2 — 2019-07-07
- 0.6.1 — 2019-06-04
- 0.6.0 — 2019-06-04
- 0.5.0 — 2019-05-29
- 0.4.0 — 2017-11-08
- 0.3.0 — 2017-02-16
- 0.2.0 — 2017-02-04
- 0.1.0 — 2017-02-02

## README

# axios-debug-log

[![Node.js CI](https://github.com/Gerhut/axios-debug-log/actions/workflows/ci.yaml/badge.svg)](https://github.com/Gerhut/axios-debug-log/actions/workflows/ci.yaml)
[![Coverage Status](https://coveralls.io/repos/github/Gerhut/axios-debug-log/badge.svg?branch=master)](https://coveralls.io/github/Gerhut/axios-debug-log?branch=master)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)

[Axios](https://www.npmjs.com/package/axios) interceptor of logging requests &amp; responses by [debug](https://www.npmjs.com/package/debug).

![Screenshot](screenshot.png "Screenshot")

## Install

    $ npm install --save axios axios-debug-log

## Node.js usage

> 1. Install: add `require('axios-debug-log')` before any axios execution.
> 2. Enable: set `DEBUG=axios` environment variables before start your fantastic Node.js application.

Or

> Add `require('axios-debug-log/enable')` before any axios execution
> to install and enable.

Or

> Run DEBUG=axios node --require axios-debug-log \[entrypoint.js\]

Or

> Run node --require axios-debug-log/enable \[entrypoint.js\]

## Browser usage

> 1. Install: add `require('axios-debug-log')` before any axios execution.
> 2. Enable: set `localStorage.debug = "axios"` before start your fantastic web application.

Or

> Add `require('axios-debug-log/enable')` before any axios execution
> to install and enable.

Please read [README of debug](https://github.com/visionmedia/debug#readme) for usage details.

## Configuration

```javascript
// Log content type
require('axios-debug-log')({
  request: function (debug, config) {
    debug('Request with ' + config.headers['content-type'])
  },
  response: function (debug, response) {
    debug(
      'Response with ' + response.headers['content-type'],
      'from ' + response.config.url
    )
  },
  error: function (debug, error) {
    // Read https://www.npmjs.com/package/axios#handling-errors for more info
    debug('Boom', error)
  }
})
```

## Customization

Use `require('axios-debug-log').addLogger(instance, debug)` to add custom debug
logger to custom instance.

```javascript
var github = axios.create({ baseURL: 'https://api.github.com/' })
var githubLogger = require('debug')('github')
require('axios-debug-log').addLogger(github, githubLogger)
github('/user')
```

## Trust by

[![octokit](https://avatars2.githubusercontent.com/u/3430433?s=200)](https://github.com/octokit)
[![SlackAPI](https://avatars3.githubusercontent.com/u/6962987?s=200)](https://github.com/slackapi)
[![Center for Public Integrity](https://avatars3.githubusercontent.com/u/459758?s=200)](https://github.com/PublicI)
[![AppImage](https://avatars0.githubusercontent.com/u/16617932?s=200)](https://github.com/AppImage)
[![pytorch](https://avatars0.githubusercontent.com/u/21003710?s=200)](https://github.com/pytorch)

*And Yours...*

## License

MIT

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