Use debug instead of console.* everywhere
No need to patch up console.* anymore also removes supererror
This commit is contained in:
@@ -8,6 +8,7 @@ exports = module.exports = {
|
||||
var assert = require('assert'),
|
||||
async = require('async'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
debug = require('debug')('box:sysinfo/generic'),
|
||||
superagent = require('superagent');
|
||||
|
||||
function getServerIp(config, callback) {
|
||||
@@ -19,11 +20,11 @@ function getServerIp(config, callback) {
|
||||
async.retry({ times: 10, interval: 5000 }, function (callback) {
|
||||
superagent.get('https://api.cloudron.io/api/v1/helper/public_ip').timeout(30 * 1000).end(function (error, result) {
|
||||
if (error || result.statusCode !== 200) {
|
||||
console.error('Error getting IP', error);
|
||||
debug('Error getting IP', error);
|
||||
return callback(new BoxError(BoxError.EXTERNAL_ERROR, 'Unable to detect IP. API server unreachable'));
|
||||
}
|
||||
if (!result.body && !result.body.ip) {
|
||||
console.error('Unexpected answer. No "ip" found in response body.', result.body);
|
||||
debug('Unexpected answer. No "ip" found in response body.', result.body);
|
||||
return callback(new BoxError(BoxError.EXTERNAL_ERROR, 'Unable to detect IP. No IP found in response'));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user