https://github.com/softonic/axios-logger
Axios plugin to log all requests and responses
https://github.com/softonic/axios-logger
Last synced: about 1 year ago
JSON representation
Axios plugin to log all requests and responses
- Host: GitHub
- URL: https://github.com/softonic/axios-logger
- Owner: softonic
- License: other
- Created: 2017-03-14T16:48:33.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-12-10T13:34:19.000Z (over 6 years ago)
- Last Synced: 2025-03-24T19:39:48.992Z (about 1 year ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 8
- Watchers: 8
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @softonic/axios-logger
Axios plugin to log all requests and responses
## Installation
```bash
npm install @softonic/axios-logger
```
## Usage
```js
// CommonJS
// const axiosLogger = require('@softonic/axios-logger');
// ES2015
import axiosLogger from '@softonic/axios-logger';
axiosLogger(axiosInstance, {
logger: bunyan.createLogger({ name: "myapp" }),
// whitelistHeaders and blacklistHeaders should not be used together
whitelistRequestHeaders: [ 'host', 'accept' ],
whitelistResponseHeaders: [ 'content-type' ],
blacklistRequestHeaders: [ 'authorization', 'cookie' ],
blacklistResponseHeaders: [ 'set-cookie' ],
});
```
## Testing
Clone the repository and execute:
```bash
npm test
```
## Contribute
1. Fork it: `git clone https://github.com/softonic/@softonic/axios-logger.git`
2. Create your feature branch: `git checkout -b feature/my-new-feature`
3. Commit your changes: `git commit -am 'Added some feature'`
4. Check the build: `npm run build`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D