Changed log to new logging
This commit is contained in:
parent
2683aac9b0
commit
c985ce4d78
@ -11,6 +11,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/event"
|
"github.com/ethereum/go-ethereum/event"
|
||||||
"github.com/ethereum/go-ethereum/logger"
|
"github.com/ethereum/go-ethereum/logger"
|
||||||
|
"github.com/ethereum/go-ethereum/logger/glog"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/ethereum/go-ethereum/pow"
|
"github.com/ethereum/go-ethereum/pow"
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
@ -90,7 +91,8 @@ func (self *BlockProcessor) ApplyTransaction(coinbase *state.StateObject, stated
|
|||||||
receipt := types.NewReceipt(statedb.Root().Bytes(), cumulative)
|
receipt := types.NewReceipt(statedb.Root().Bytes(), cumulative)
|
||||||
receipt.SetLogs(statedb.Logs())
|
receipt.SetLogs(statedb.Logs())
|
||||||
receipt.Bloom = types.CreateBloom(types.Receipts{receipt})
|
receipt.Bloom = types.CreateBloom(types.Receipts{receipt})
|
||||||
chainlogger.Debugln(receipt)
|
|
||||||
|
glog.V(logger.Debug).Infoln(receipt)
|
||||||
|
|
||||||
// Notify all subscribers
|
// Notify all subscribers
|
||||||
if !transientProcess {
|
if !transientProcess {
|
||||||
@ -120,7 +122,7 @@ func (self *BlockProcessor) ApplyTransactions(coinbase *state.StateObject, state
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
statelogger.Infoln("TX err:", err)
|
glog.V(logger.Core).Infoln("TX err:", err)
|
||||||
}
|
}
|
||||||
receipts = append(receipts, receipt)
|
receipts = append(receipts, receipt)
|
||||||
|
|
||||||
@ -357,7 +359,7 @@ func (sm *BlockProcessor) GetLogs(block *types.Block) (logs state.Logs, err erro
|
|||||||
func putTx(db common.Database, tx *types.Transaction, block *types.Block, i uint64) {
|
func putTx(db common.Database, tx *types.Transaction, block *types.Block, i uint64) {
|
||||||
rlpEnc, err := rlp.EncodeToBytes(tx)
|
rlpEnc, err := rlp.EncodeToBytes(tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
statelogger.Infoln("Failed encoding tx", err)
|
glog.V(logger.Debug).Infoln("Failed encoding tx", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
db.Put(tx.Hash().Bytes(), rlpEnc)
|
db.Put(tx.Hash().Bytes(), rlpEnc)
|
||||||
@ -372,7 +374,7 @@ func putTx(db common.Database, tx *types.Transaction, block *types.Block, i uint
|
|||||||
txExtra.Index = i
|
txExtra.Index = i
|
||||||
rlpMeta, err := rlp.EncodeToBytes(txExtra)
|
rlpMeta, err := rlp.EncodeToBytes(txExtra)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
statelogger.Infoln("Failed encoding meta", err)
|
glog.V(logger.Debug).Infoln("Failed encoding tx meta data", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
db.Put(append(tx.Hash().Bytes(), 0x0001), rlpMeta)
|
db.Put(append(tx.Hash().Bytes(), 0x0001), rlpMeta)
|
||||||
|
@ -187,7 +187,9 @@ func (bc *ChainManager) setLastBlock() {
|
|||||||
bc.Reset()
|
bc.Reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
chainlogger.Infof("Last block (#%v) %x TD=%v\n", bc.currentBlock.Number(), bc.currentBlock.Hash(), bc.td)
|
if glog.V(logger.Info) {
|
||||||
|
glog.Infof("Last block (#%v) %x TD=%v\n", bc.currentBlock.Number(), bc.currentBlock.Hash(), bc.td)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bc *ChainManager) makeCache() {
|
func (bc *ChainManager) makeCache() {
|
||||||
@ -285,7 +287,7 @@ func (bc *ChainManager) ResetWithGenesisBlock(gb *types.Block) {
|
|||||||
func (self *ChainManager) Export(w io.Writer) error {
|
func (self *ChainManager) Export(w io.Writer) error {
|
||||||
self.mu.RLock()
|
self.mu.RLock()
|
||||||
defer self.mu.RUnlock()
|
defer self.mu.RUnlock()
|
||||||
chainlogger.Infof("exporting %v blocks...\n", self.currentBlock.Header().Number)
|
glog.V(logger.Info).Infof("exporting %v blocks...\n", self.currentBlock.Header().Number)
|
||||||
for block := self.currentBlock; block != nil; block = self.GetBlock(block.Header().ParentHash) {
|
for block := self.currentBlock; block != nil; block = self.GetBlock(block.Header().ParentHash) {
|
||||||
if err := block.EncodeRLP(w); err != nil {
|
if err := block.EncodeRLP(w); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -332,7 +334,6 @@ func (self *ChainManager) GetBlockHashesFromHash(hash common.Hash, max uint64) (
|
|||||||
parentHash := block.Header().ParentHash
|
parentHash := block.Header().ParentHash
|
||||||
block = self.GetBlock(parentHash)
|
block = self.GetBlock(parentHash)
|
||||||
if block == nil {
|
if block == nil {
|
||||||
chainlogger.Infof("GetBlockHashesFromHash Parent UNKNOWN %x\n", parentHash)
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,7 +478,10 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
|
|||||||
if block.Header().Number.Cmp(new(big.Int).Add(cblock.Header().Number, common.Big1)) < 0 {
|
if block.Header().Number.Cmp(new(big.Int).Add(cblock.Header().Number, common.Big1)) < 0 {
|
||||||
chash := cblock.Hash()
|
chash := cblock.Hash()
|
||||||
hash := block.Hash()
|
hash := block.Hash()
|
||||||
chainlogger.Infof("Split detected. New head #%v (%x) TD=%v, was #%v (%x) TD=%v\n", block.Header().Number, hash[:4], td, cblock.Header().Number, chash[:4], self.td)
|
|
||||||
|
if glog.V(logger.Info) {
|
||||||
|
glog.Infof("Split detected. New head #%v (%x) TD=%v, was #%v (%x) TD=%v\n", block.Header().Number, hash[:4], td, cblock.Header().Number, chash[:4], self.td)
|
||||||
|
}
|
||||||
|
|
||||||
queue[i] = ChainSplitEvent{block, logs}
|
queue[i] = ChainSplitEvent{block, logs}
|
||||||
queueEvent.splitCount++
|
queueEvent.splitCount++
|
||||||
@ -513,7 +517,7 @@ func (self *ChainManager) InsertChain(chain types.Blocks) error {
|
|||||||
|
|
||||||
if len(chain) > 0 && glog.V(logger.Info) {
|
if len(chain) > 0 && glog.V(logger.Info) {
|
||||||
start, end := chain[0], chain[len(chain)-1]
|
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())
|
glog.Infof("imported %d blocks #%v [%x / %x]\n", len(chain), end.Number(), start.Hash().Bytes()[:4], end.Hash().Bytes()[:4])
|
||||||
}
|
}
|
||||||
|
|
||||||
go self.eventMux.Post(queueEvent)
|
go self.eventMux.Post(queueEvent)
|
||||||
|
@ -349,7 +349,7 @@ func (self *ethProtocol) handleStatus() error {
|
|||||||
return self.protoError(ErrSuspendedPeer, "")
|
return self.protoError(ErrSuspendedPeer, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
self.peer.Infof("Peer is [eth] capable (%d/%d). TD=%v H=%x\n", status.ProtocolVersion, status.NetworkId, status.TD, status.CurrentBlock[:4])
|
self.peer.Debugf("Peer is [eth] capable (%d/%d). TD=%v H=%x\n", status.ProtocolVersion, status.NetworkId, status.TD, status.CurrentBlock[:4])
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user