improve logging on Sync

This commit is contained in:
Manuel Araoz 2014-08-20 15:58:21 -04:00
parent 7a24d3bcd8
commit 8de655eb2b

View File

@ -86,10 +86,10 @@ Sync.prototype.storeTipBlock = function(b, allowReorgs, cb) {
var self = this; var self = this;
if ( self.storingBlock ) { if ( self.storingBlock ) {
console.log('## Storing a block already. Delaying storeTipBlock with:' + logger.debug('Storing a block already. Delaying storeTipBlock with:' +
b.hash); b.hash);
return setTimeout( function() { return setTimeout( function() {
console.log('## Retrying storeTipBlock with: ' + b.hash); logger.debug('Retrying storeTipBlock with: ' + b.hash);
self.storeTipBlock(b,allowReorgs,cb); self.storeTipBlock(b,allowReorgs,cb);
}, 1000); }, 1000);
} }
@ -123,7 +123,7 @@ Sync.prototype.storeTipBlock = function(b, allowReorgs, cb) {
oldHeight = hash ? (h || 0) : -1 oldHeight = hash ? (h || 0) : -1
if (oldTip && newPrev !== oldTip) { if (oldTip && newPrev !== oldTip) {
needReorg = true; needReorg = true;
console.log('## REORG Triggered, tip mismatch'); logger.debug('REORG Triggered, tip mismatch');
} }
return c(); return c();
}); });
@ -195,7 +195,7 @@ Sync.prototype.processReorg = function(oldTip, oldNext, newPrev, oldHeight, cb)
if (height<0) return c(); if (height<0) return c();
newHeight = height + 1; newHeight = height + 1;
info('# Reorg Case 1) OldNext: %s NewHeight: %d', oldNext, newHeight); info('Reorg Case 1) OldNext: %s NewHeight: %d', oldNext, newHeight);
orphanizeFrom = oldNext; orphanizeFrom = oldNext;
return c(err); return c(err);
}); });
@ -203,7 +203,7 @@ Sync.prototype.processReorg = function(oldTip, oldNext, newPrev, oldHeight, cb)
function(c) { function(c) {
if (orphanizeFrom) return c(); if (orphanizeFrom) return c();
info('# Reorg Case 2)'); info('Reorg Case 2)');
self.setBranchConnectedBackwards(newPrev, function(err, yHash, newYHashNext, height) { self.setBranchConnectedBackwards(newPrev, function(err, yHash, newYHashNext, height) {
if (err) return c(err); if (err) return c(err);
newHeight = height; newHeight = height;