Use debug instead of console

This commit is contained in:
Raul Ochoa 2015-09-17 11:06:46 +02:00
parent e335f51dbc
commit f9f6c8b700

View File

@ -2,6 +2,7 @@ var assert = require('assert');
var _ = require('underscore');
var step = require('step');
var debug = require('debug')('windshaft:cartodb');
var LZMA = require('lzma').LZMA;
var lzmaWorker = new LZMA();
@ -171,7 +172,7 @@ BaseController.prototype.send = function(req, res, args) {
// See http://github.com/CartoDB/Windshaft/issues/166
req.profiler.sendStats();
} catch (err) {
console.error("error sending profiling stats: " + err);
debug("error sending profiling stats: " + err);
}
}
};
@ -181,12 +182,7 @@ BaseController.prototype.sendError = function(req, res, err, label) {
var statusCode = findStatusCode(err);
// use console.log for statusCode != 500 ?
if (statusCode >= 500) {
console.error('[%s ERROR] -- %d: %s', label, statusCode, err);
} else {
console.warn('[%s WARN] -- %d: %s', label, statusCode, err);
}
debug('[%s ERROR] -- %d: %s', label, statusCode, err);
// If a callback was requested, force status to 200
if (req.query && req.query.callback) {