...
|
...
|
@@ -58,7 +58,13 @@ class Api extends Context { |
|
|
|
|
|
return request(params, (error, response) => {
|
|
|
if (!error) {
|
|
|
logger.info(`api call ${response.statusCode} [${response.request.method}] ${response.request.href} ${response.request.body}`); // eslint-disable-line
|
|
|
if (response && /^20\d/.test(response.statusCode)) {
|
|
|
logger.info(`api call ${response.statusCode} [${response.request.method}] ${response.request.href} ${response.request.body}`); // eslint-disable-line
|
|
|
} else {
|
|
|
let res = response.toJSON();
|
|
|
|
|
|
logger.error(`api call ${res.statusCode} [${res.request.method}] ${res.request.uri.href} ${res.body || ''}`); // eslint-disable-line
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
...
|
...
|
|