Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

axios-logger

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-logger - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

package.json
{
"name": "axios-logger",
"version": "0.1.0",
"version": "0.1.1",
"description": "Beautify Axios Logging Messages",

@@ -5,0 +5,0 @@ "main": "src/index.js",

# axios-logger
> Beautify Axios Logging Messages.

@@ -7,4 +8,8 @@

Basically This package is working as [Axios's interceptors](https://github.com/axios/axios#interceptors).
![sample](https://user-images.githubusercontent.com/10627668/41816761-1700b662-77c8-11e8-80d4-7d223169364a.png)
# Install
## Install
```

@@ -14,6 +19,8 @@ $ npm install axios-logger --save-dev

# How to use
You can use logger with `axios` interceptor.
## How to use
#### Request
You can use various loggers through the `axios`'s interceptor API.
### Logging Request
```javascript

@@ -27,11 +34,13 @@ import axios from 'axios';

If you want to use your custom interceptor, you can mixin with logger like this.
If you want to use your own interceptor, you can compose(mixin) with `requestLogger`.
```javascript
instance.interceptors.request.use((config) => {
// write down your request intercept.
AxiosLogger.requestLogger(config);
return AxiosLogger.requestLogger(config);
});
```
#### Response
### Logging Response
```javascript

@@ -45,12 +54,15 @@ import axios from 'axios';

If you want to use your custom interceptor, you can mixin with logger like this.
Also if you want to use your own interceptor, you can compose(mixin) with `responseLogger`.
```javascript
instance.interceptors.response.use((response) => {
// write down your response intercept.
AxiosLogger.responseLogger(response);
return AxiosLogger.responseLogger(response);
});
```
#### Error
You can errorLogger that pass second argument.
### Error
You can inject `errorLogger` right after `requestLogger` or `responseLogger`.
```javascript

@@ -65,11 +77,13 @@ import axios from 'axios';

If you want to use your custom interceptor, you can mixin with logger like this.
Also if you want to use your own interceptor, you can compose(mixin) with `errorLogger`.
```javascript
instance.interceptors.response.use(AxiosLogger.requestLogger, (err) =>{
// write down your error intercept.
AxiosLogger.errorLogger(err);
return AxiosLogger.errorLogger(err);
});
```
# CONTRIBUTE
I always welcome Feedback and Pall Request :)
## CONTRIBUTE
I always welcome Feedback and Pull Request :)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc