Skip to content

Instantly share code, notes, and snippets.

@isnifer
Created January 26, 2018 06:19
Show Gist options
  • Save isnifer/63069529c3134c5e31a0b6fc0e180634 to your computer and use it in GitHub Desktop.
Save isnifer/63069529c3134c5e31a0b6fc0e180634 to your computer and use it in GitHub Desktop.
/* eslint-disable no-console */
export default function requestsLogger(params) {
const {
fullUrl,
method,
headers,
json,
response: { status, statusText },
requestType,
} = params
console.groupCollapsed(requestType)
console.log(
JSON.stringify({
URL: fullUrl,
METHOD: method,
HEADERS: headers,
STATUS: status,
STATUS_TEXT: statusText,
RESPONSE: json,
}, null, 2)
)
console.groupEnd()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment