axios-logger
Advanced tools
Comparing version 2.6.0 to 2.6.1
@@ -27,2 +27,4 @@ export interface CommonConfig { | ||
data?: boolean; | ||
status?: boolean; | ||
statusText?: boolean; | ||
} |
import { AxiosError } from 'axios'; | ||
import { ErrorLogConfig } from '../common/types'; | ||
declare function errorLoggerWithoutPromise(error: AxiosError, config?: ErrorLogConfig): AxiosError<any>; | ||
declare function errorLogger(error: AxiosError, config?: ErrorLogConfig): Promise<never>; | ||
declare function errorLogger(error: AxiosError, config?: ErrorLogConfig): Promise<AxiosError<any>>; | ||
export { errorLogger, errorLoggerWithoutPromise }; |
@@ -16,2 +16,6 @@ "use strict"; | ||
function errorLoggerWithoutPromise(error, config = {}) { | ||
if (!error.config) { | ||
return error; | ||
} | ||
const { | ||
@@ -45,2 +49,2 @@ config: { | ||
} | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2dnZXIvZXJyb3IudHMiXSwibmFtZXMiOlsiZXJyb3JMb2dnZXJXaXRob3V0UHJvbWlzZSIsImVycm9yIiwiY29uZmlnIiwibWV0aG9kIiwiYmFzZVVSTCIsInBhcmFtcyIsInVybCIsInJlc3BvbnNlIiwic3RhdHVzIiwic3RhdHVzVGV4dCIsImRhdGEiLCJoZWFkZXJzIiwiYnVpbGRDb25maWciLCJzdHJpbmdCdWlsZGVyIiwiU3RyaW5nQnVpbGRlciIsImxvZyIsIm1ha2VMb2dUeXBlV2l0aFByZWZpeCIsIm1ha2VEYXRlRm9ybWF0IiwiRGF0ZSIsIm1ha2VNZXRob2QiLCJtYWtlVXJsIiwibWFrZVBhcmFtcyIsIm1ha2VTdGF0dXMiLCJtYWtlSGVhZGVyIiwibWFrZURhdGEiLCJidWlsZCIsImxvZ2dlciIsImVycm9yTG9nZ2VyIiwiUHJvbWlzZSIsInJlamVjdCJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7QUFFQTs7QUFDQTs7OztBQ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gICBjb25zdCBidWlsZENvbmZpZyA9IGFzc2VtYmxlQnVpbGRDb25maWcoY29uZmlnKTtcblxuICAgIGNvbnN0IHN0cmluZ0J1aWxkZXIgPSBuZXcgU3RyaW5nQnVpbGRlcihidWlsZENvbmZpZyk7XG4gICAgY29uc3QgbG9nID0gc3RyaW5nQnVpbGRlclxuICAgICAgICAubWFrZUxvZ1R5cGVXaXRoUHJlZml4KCdFcnJvcicpXG4gICAgICAgIC5tYWtlRGF0ZUZvcm1hdChuZXcgRGF0ZSgpKVxuICAgICAgICAubWFrZU1ldGhvZChtZXRob2QpXG4gICAgICAgIC5tYWtlVXJsKHVybCwgYmFzZVVSTClcbiAgICAgICAgLm1ha2VQYXJhbXMocGFyYW1zKVxuICAgICAgICAubWFrZVN0YXR1cyhzdGF0dXMsIHN0YXR1c1RleHQpXG4gICAgICAgIC5tYWtlSGVhZGVyKGhlYWRlcnMpXG4gICAgICAgIC5tYWtlRGF0YShkYXRhKVxuICAgICAgICAuYnVpbGQoKTtcblxuICAgIGJ1aWxkQ29uZmlnLmxvZ2dlcihsb2cpO1xuXG4gICAgcmV0dXJuIGVycm9yO1xufVxuXG5mdW5jdGlvbiBlcnJvckxvZ2dlcihlcnJvcjogQXhpb3NFcnJvciwgY29uZmlnPzogRXJyb3JMb2dDb25maWcpIHtcbiAgICByZXR1cm4gUHJvbWlzZS5yZWplY3QoZXJyb3JMb2dnZXJXaXRob3V0UHJvbWlzZShlcnJvciwgY29uZmlnKSk7XG59XG5cbmV4cG9ydCB7IGVycm9yTG9nZ2VyLCBlcnJvckxvZ2dlcldpdGhvdXRQcm9taXNlIH07XG4iXX0= | ||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2dnZXIvZXJyb3IudHMiXSwibmFtZXMiOlsiZXJyb3JMb2dnZXJXaXRob3V0UHJvbWlzZSIsImVycm9yIiwiY29uZmlnIiwibWV0aG9kIiw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AgICAgLm1ha2VIZWFkZXIoaGVhZGVycylcbiAgICAgICAgLm1ha2VEYXRhKGRhdGEpXG4gICAgICAgIC5idWlsZCgpO1xuXG4gICAgYnVpbGRDb25maWcubG9nZ2VyKGxvZyk7XG5cbiAgICByZXR1cm4gZXJyb3I7XG59XG5cbmZ1bmN0aW9uIGVycm9yTG9nZ2VyKGVycm9yOiBBeGlvc0Vycm9yLCBjb25maWc/OiBFcnJvckxvZ0NvbmZpZykge1xuICAgIHJldHVybiBQcm9taXNlLnJlamVjdDxBeGlvc0Vycm9yPihlcnJvckxvZ2dlcldpdGhvdXRQcm9taXNlKGVycm9yLCBjb25maWcpKTtcbn1cblxuZXhwb3J0IHsgZXJyb3JMb2dnZXIsIGVycm9yTG9nZ2VyV2l0aG91dFByb21pc2UgfTtcbiJdfQ== |
{ | ||
"name": "axios-logger", | ||
"version": "2.6.0", | ||
"version": "2.6.1", | ||
"description": "Beautify Axios Logging Messages", | ||
@@ -36,2 +36,3 @@ "main": "lib/index.js", | ||
"@babel/preset-typescript": "^7.12.7", | ||
"@types/dateformat": "^3.0.1", | ||
"@types/jest": "^24.9.1", | ||
@@ -52,3 +53,2 @@ "@types/node": "^12.19.9", | ||
"dependencies": { | ||
"@types/dateformat": "^3.0.1", | ||
"chalk": "^4.1.0", | ||
@@ -55,0 +55,0 @@ "dateformat": "^3.0.3" |
@@ -122,13 +122,14 @@ # axios-logger | ||
| Property | Type | Default | Description | | ||
| ------------ | ------------------------------------------------------------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `method` | boolean | `true` | Whether to include HTTP method or not. | | ||
| `url` | boolean | `true` | Whether to include the URL or not. | | ||
| `params` | boolean | `false` | Whether to include the URL params or not. | | ||
| `data` | boolean | `true` | Whether to include request/response data or not. | | ||
| `status` | boolean | `true` | Whether to include response statuses or not. | | ||
| `headers` | boolean | `false` | Whether to include HTTP headers or not. | | ||
| `prefixText` | string \| `false` | `'Axios'` | `false` => no prefix, otherwise, customize the prefix wanted. | | ||
| `dateFormat` | [dateformat](https://github.com/felixge/node-dateformat) \| `false` | `new Date().toISOString()` | `false` => no timestamp, otherwise, customize its format | | ||
| `logger` | function<string, any> | `console.log` | Allows users to customize the logger function to be used. e.g. Winston's `logger.info` could be leveraged, like this: `logger.info.bind(this)` | | ||
| Property | Type | Default | Description | | ||
| ------------ | ------------------------------------------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `method` | boolean | `true` | Whether to include HTTP method or not. | | ||
| `url` | boolean | `true` | Whether to include the URL or not. | | ||
| `params` | boolean | `false` | Whether to include the URL params or not. | | ||
| `data` | boolean | `true` | Whether to include request/response data or not. | | ||
| `status` | boolean | `true` | Whether to include response statuses or not. | | ||
| `statusText` | boolean | `true` | Whether to include response status text or not. | | ||
| `headers` | boolean | `false` | Whether to include HTTP headers or not. | | ||
| `prefixText` | string \| `false` | `'Axios'` | `false` => no prefix, otherwise, customize the prefix wanted. | | ||
| `dateFormat` | [dateformat](https://github.com/felixge/node-dateformat) \| `false` | `false` | `false` => no timestamp, otherwise, customize its format | | ||
| `logger` | function<string, any> | `console.log` | Allows users to customize the logger function to be used. e.g. Winston's `logger.info` could be leveraged, like this: `logger.info.bind(this)` | | ||
@@ -135,0 +136,0 @@ ## CONTRIBUTE |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45047
2
319
138
20
- Removed@types/dateformat@^3.0.1
- Removed@types/dateformat@3.0.1(transitive)