Use debug instead of console

This commit is contained in:
Raul Ochoa 2015-09-17 11:06:46 +02:00
parent 7fd870cfd2
commit 361dd00e9d

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();
@ -181,7 +182,7 @@ BaseController.prototype.send = function(req, res, body, status, headers) {
// 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);
}
}
};
@ -192,12 +193,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) {