From 946408f36e656e773e61aff01c5adf96d7c9bf9d Mon Sep 17 00:00:00 2001 From: cubedro Date: Wed, 28 Oct 2015 23:23:17 +0200 Subject: [PATCH] less logging --- lib/history.js | 2 +- lib/utils/logger.js | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/history.js b/lib/history.js index 5599f6e..8caa69f 100644 --- a/lib/history.js +++ b/lib/history.js @@ -639,7 +639,7 @@ History.prototype.requiresUpdate = function() History.prototype.getHistoryRequestRange = function() { - if( this._items.length < 5 ) + if( this._items.length < 2 ) return false; var blocks = _.pluck( this._items, 'height' ); diff --git a/lib/utils/logger.js b/lib/utils/logger.js index 7d70085..eaa9d9d 100644 --- a/lib/utils/logger.js +++ b/lib/utils/logger.js @@ -31,6 +31,15 @@ var typeColors = { 'PIN': chalk.reset.bold.yellow, }; +var verbosity = [ + [], + ['error'], + ['error', 'warn', 'success'], + ['info', 'error', 'warn', 'success', 'time', 'timeEnd'] +]; + +var ENV_VERBOSITY = process.env.VERBOSITY || 2; + [ { name: "info", @@ -102,6 +111,9 @@ var typeColors = { console[item.name] = function () { + if(verbosity[ENV_VERBOSITY].indexOf(fnName) === -1) + return false; + var args = Array.prototype.slice.call(arguments); var type = null, sign,