use logrus

This commit is contained in:
Ian Norden 2020-08-19 11:35:09 -05:00
parent 0197f638f2
commit 83bbb9aa70
2 changed files with 11 additions and 11 deletions

View File

@ -1,14 +1,14 @@
[leveldb] [leveldb]
path = "" path = "/Users/user/Library/Ethereum/geth/chaindata"
ancient = "" ancient = "/Users/user/Library/Ethereum/geth/chaindata/ancient"
[server] [server]
ipcPath = "" ipcPath = ".ipc"
httpPath = "" httpPath = "127.0.0.1:8545"
[log] [log]
file = "" file = ""
level = "" level = "info"
[eth] [eth]
chainID = 1 chainID = 1

View File

@ -24,12 +24,12 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state" "github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp" "github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc" "github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/statediff" "github.com/ethereum/go-ethereum/statediff"
"github.com/sirupsen/logrus"
) )
// lvlDBReader are the db interfaces required by the statediffing service // lvlDBReader are the db interfaces required by the statediffing service
@ -95,7 +95,7 @@ func (sds *Service) Loop(wg *sync.WaitGroup) {
for { for {
select { select {
case <-sds.QuitChan: case <-sds.QuitChan:
log.Info("closing the statediff service loop") logrus.Info("closing the statediff service loop")
wg.Done() wg.Done()
return return
} }
@ -109,7 +109,7 @@ func (sds *Service) StateDiffAt(blockNumber uint64, params statediff.Params) (*s
if err != nil { if err != nil {
return nil, err return nil, err
} }
log.Info(fmt.Sprintf("sending state diff at block %d", blockNumber)) logrus.Info(fmt.Sprintf("sending state diff at block %d", blockNumber))
if blockNumber == 0 { if blockNumber == 0 {
return sds.processStateDiff(currentBlock, common.Hash{}, params) return sds.processStateDiff(currentBlock, common.Hash{}, params)
} }
@ -177,7 +177,7 @@ func (sds *Service) StateTrieAt(blockNumber uint64, params statediff.Params) (*s
if err != nil { if err != nil {
return nil, err return nil, err
} }
log.Info(fmt.Sprintf("sending state trie at block %d", blockNumber)) logrus.Info(fmt.Sprintf("sending state trie at block %d", blockNumber))
return sds.processStateTrie(currentBlock, params) return sds.processStateTrie(currentBlock, params)
} }
@ -195,14 +195,14 @@ func (sds *Service) processStateTrie(block *types.Block, params statediff.Params
// Start is used to begin the service // Start is used to begin the service
func (sds *Service) Start(*p2p.Server) error { func (sds *Service) Start(*p2p.Server) error {
log.Info("starting statediff service") logrus.Info("starting statediff service")
go sds.Loop(new(sync.WaitGroup)) go sds.Loop(new(sync.WaitGroup))
return nil return nil
} }
// Stop is used to close down the service // Stop is used to close down the service
func (sds *Service) Stop() error { func (sds *Service) Stop() error {
log.Info("stopping statediff service") logrus.Info("stopping statediff service")
close(sds.QuitChan) close(sds.QuitChan)
return nil return nil
} }