From f9f6c8b700463ec9bd966328cb23da59cb140cf6 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Thu, 17 Sep 2015 11:06:46 +0200 Subject: [PATCH] Use debug instead of console --- lib/cartodb/controllers/base.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/cartodb/controllers/base.js b/lib/cartodb/controllers/base.js index 7860e1ed..ce005055 100644 --- a/lib/cartodb/controllers/base.js +++ b/lib/cartodb/controllers/base.js @@ -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) {