fix weird logging bug
This commit is contained in:
parent
f1c3d7c498
commit
4628f20f9f
@ -26,7 +26,6 @@ var async = require('async');
|
||||
|
||||
|
||||
var logger = require('./logger').logger;
|
||||
var d = logger.log;
|
||||
var info = logger.info;
|
||||
|
||||
var BlockDb = function(opts) {
|
||||
@ -113,7 +112,7 @@ BlockDb.prototype._changeBlockHeight = function(hash, height, cb) {
|
||||
var self = this;
|
||||
var dbScript1 = this._setHeightScript(hash,height);
|
||||
|
||||
d('Getting TXS FROM %s to set it Main', hash);
|
||||
logger.log('Getting TXS FROM %s to set it Main', hash);
|
||||
this.fromHashWithInfo(hash, function(err, bi) {
|
||||
if (!bi || !bi.info || !bi.info.tx)
|
||||
throw new Error('unable to get info for block:'+ hash);
|
||||
@ -121,10 +120,10 @@ BlockDb.prototype._changeBlockHeight = function(hash, height, cb) {
|
||||
var dbScript2;
|
||||
if (height>=0) {
|
||||
dbScript2 = self._addTxsScript(bi.info.tx, hash, height);
|
||||
info('\t%s %d Txs', 'Confirming', bi.info.tx.length);
|
||||
logger.info('\t%s %d Txs', 'Confirming', bi.info.tx.length);
|
||||
} else {
|
||||
dbScript2 = self._delTxsScript(bi.info.tx);
|
||||
info('\t%s %d Txs', 'Unconfirming', bi.info.tx.length);
|
||||
logger.info('\t%s %d Txs', 'Unconfirming', bi.info.tx.length);
|
||||
}
|
||||
db.batch(dbScript2.concat(dbScript1),cb);
|
||||
});
|
||||
@ -230,7 +229,7 @@ BlockDb.prototype.getHeight = function(hash, cb) {
|
||||
};
|
||||
|
||||
BlockDb.prototype._setHeightScript = function(hash, height) {
|
||||
d('setHeight: %s #%d', hash,height);
|
||||
logger.log('setHeight: %s #%d', hash,height);
|
||||
return ([{
|
||||
type: 'put',
|
||||
key: MAIN_PREFIX + hash,
|
||||
|
||||
@ -1,7 +1,13 @@
|
||||
var winston = require('winston');
|
||||
|
||||
var logger = winston;
|
||||
logger.transports.Console.level = 'debug';
|
||||
var logger = new winston.Logger({
|
||||
transports: [
|
||||
new winston.transports.Console({
|
||||
level: 'error'
|
||||
}),
|
||||
]
|
||||
});
|
||||
logger.transports.console.level = 'debug';
|
||||
logger.info('starting...');
|
||||
|
||||
module.exports.logger = logger;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user