Merge pull request #338 from braydonf/logs

Add date to logs and formatting changes.
This commit is contained in:
Gabe Gattis 2015-10-21 15:09:18 -04:00
commit 9832991c10
2 changed files with 5 additions and 6 deletions

View File

@ -6,8 +6,7 @@ var colors = require('colors/safe');
* Wraps console.log with some special magic * Wraps console.log with some special magic
* @constructor * @constructor
*/ */
function Logger(namespace) { function Logger() {
this.namespace = namespace || 'bitcore-node';
} }
/** /**
@ -53,9 +52,9 @@ Logger.prototype._log = function(color, type) {
var args = Array.prototype.slice.call(arguments); var args = Array.prototype.slice.call(arguments);
args = args.slice(1); args = args.slice(1);
var name = colors.bold('{' + this.namespace + '}'); var date = new Date();
var type = colors[color].italic(args.shift() + ':'); var typeString = colors[color].italic(args.shift() + ':');
args[0] = name + ' ' + type + ' ' + args[0]; args[0] = '[' + date.toISOString() + ']' + ' ' + typeString + ' ' + args[0];
console.log.apply(console, args); console.log.apply(console, args);
}; };

View File

@ -96,7 +96,7 @@ Bitcoin.prototype._onTipUpdate = function(result) {
// TODO stopping status // TODO stopping status
if(!this.node.stopping) { if(!this.node.stopping) {
var percentage = this.syncPercentage(); var percentage = this.syncPercentage();
log.info('Bitcoin Core Daemon New Height:', this.height, 'Percentage:', percentage); log.info('Bitcoin Height:', this.height, 'Percentage:', percentage);
} }
// Recursively wait until the next update // Recursively wait until the next update