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