basic glog

This commit is contained in:
obscuren
2015-04-04 12:40:11 +02:00
parent 60e097a5f4
commit a0e44e3281
10 changed files with 47 additions and 49 deletions

View File

@ -12,6 +12,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
)
@ -494,6 +495,10 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
queue[i] = ChainEvent{block, logs}
queueEvent.canonicalCount++
if glog.V(logger.Debug) {
glog.Infof("inserted block #%d (%d TXs %d UNCs) (%x...)\n", block.Number(), len(block.Transactions()), len(block.Uncles()), block.Hash().Bytes()[0:4])
}
} else {
queue[i] = ChainSideEvent{block, logs}
queueEvent.sideCount++
@ -503,6 +508,11 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
}
if len(chain) > 0 && glog.V(logger.Info) {
start, end := chain[0], chain[len(chain)-1]
glog.Infof("imported %d blocks [%x / %x] #%v\n", len(chain), start.Hash().Bytes()[:4], end.Hash().Bytes()[:4], end.Number())
}
go self.eventMux.Post(queueEvent)
return nil