Updated logging

This commit is contained in:
obscuren
2015-04-07 14:57:04 +02:00
parent 01b2c90179
commit 688d118c7e
13 changed files with 76 additions and 58 deletions

View File

@ -452,7 +452,7 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
var (
queue = make([]interface{}, len(chain))
queueEvent = queueEvent{queue: queue}
stats struct{ delayed, processed int }
stats struct{ queued, processed int }
tstart = time.Now()
)
for i, block := range chain {
@ -472,13 +472,13 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
// future block for future use
if err == BlockFutureErr {
self.futureBlocks.Push(block)
stats.delayed++
stats.queued++
continue
}
if IsParentErr(err) && self.futureBlocks.Has(block.ParentHash()) {
self.futureBlocks.Push(block)
stats.delayed++
stats.queued++
continue
}
@ -545,10 +545,10 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
}
if (stats.delayed > 0 || stats.processed > 0) && bool(glog.V(logger.Info)) {
if (stats.queued > 0 || stats.processed > 0) && bool(glog.V(logger.Info)) {
tend := time.Since(tstart)
start, end := chain[0], chain[len(chain)-1]
glog.Infof("imported %d block(s) %d delayed in %v. #%v [%x / %x]\n", stats.processed, stats.delayed, tend, end.Number(), start.Hash().Bytes()[:4], end.Hash().Bytes()[:4])
glog.Infof("imported %d block(s) %d queued in %v. #%v [%x / %x]\n", stats.processed, stats.queued, tend, end.Number(), start.Hash().Bytes()[:4], end.Hash().Bytes()[:4])
}
go self.eventMux.Post(queueEvent)