Added loglevel
This patch adds loglevel back in as our logging framework, as an assistatn for debugging the in/outbound HTTP requests. Change-Id: I545e27f5c957f9c5c7a2dc73730b9db91600c1ce
This commit is contained in:
@@ -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",
|
||||
|
@@ -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 {
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user