diff --git a/package.json b/package.json index 50dcfb9..2ad7aeb 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,8 @@ "homepage": "http://www.openstack.org/", "dependencies": { "babel-polyfill": "^6.9.1", - "isomorphic-fetch": "^2.2.1" + "isomorphic-fetch": "^2.2.1", + "loglevel": "^1.4.1" }, "devDependencies": { "babel-cli": "^6.10.1", diff --git a/src/util/http.js b/src/util/http.js index f570c60..cb7815b 100644 --- a/src/util/http.js +++ b/src/util/http.js @@ -15,6 +15,7 @@ */ import 'isomorphic-fetch'; +import log from 'loglevel'; /** * This utility class provides an abstraction layer for HTTP calls via fetch(). Its purpose is @@ -79,7 +80,7 @@ export default class Http { // Build the wrapper promise. return new Promise((resolve, reject) => { - + log.debug('-->', `HTTP ${method}`, url, JSON.stringify(headers), JSON.stringify(body)); let promise = fetch(request.url, init); // Fetch will treat all http responses (2xx, 3xx, 4xx, 5xx, etc) as successful responses. @@ -87,6 +88,7 @@ export default class Http { // that it's up to the downstream developer to determine whether what they received is an // error or a failed response. promise.then((response) => { + log.debug('<--', `HTTP ${response.status}`); if (response.status >= 400) { return reject(response); } else { diff --git a/test/functional/keystoneTest.js b/test/functional/keystoneTest.js index 339eae6..95408e0 100644 --- a/test/functional/keystoneTest.js +++ b/test/functional/keystoneTest.js @@ -17,6 +17,9 @@ import Version from '../../src/util/version'; import Keystone from "../../src/keystone"; import config from "./helpers/cloudsConfig"; +import log from 'loglevel'; + +log.setLevel("DEBUG"); describe("Keystone", () => { let devstackConfig = config.clouds.devstack;