diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-02-22 20:10:07 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-02-23 18:16:44 +0800 |
commit | d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851 (patch) | |
tree | 17c93170551d3eeabe2935de1765f157007f0dc2 /p2p/discover/table.go | |
parent | 47af53f9aaf9aa7b12cd976eb150ccf3d64da6fd (diff) | |
download | go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.gz go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.bz2 go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.lz go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.xz go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.tar.zst go-tangerine-d4fd06c3dc6cd6d2dbd2bfebfee5bcb46a504851.zip |
all: blidly swap out glog to our log15, logs need rework
Diffstat (limited to 'p2p/discover/table.go')
-rw-r--r-- | p2p/discover/table.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/p2p/discover/table.go b/p2p/discover/table.go index 839e3ec7e..03392b563 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -34,8 +34,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/logger" - "github.com/ethereum/go-ethereum/logger/glog" + "github.com/ethereum/go-ethereum/log" ) const ( @@ -278,10 +277,10 @@ func (tab *Table) lookup(targetID NodeID, refreshIfEmpty bool) []*Node { // Bump the failure counter to detect and evacuate non-bonded entries fails := tab.db.findFails(n.ID) + 1 tab.db.updateFindFails(n.ID, fails) - glog.V(logger.Detail).Infof("Bumping failures for %x: %d", n.ID[:8], fails) + log.Trace(fmt.Sprintf("Bumping failures for %x: %d", n.ID[:8], fails)) if fails >= maxFindnodeFailures { - glog.V(logger.Detail).Infof("Evacuating node %x: %d findnode failures", n.ID[:8], fails) + log.Trace(fmt.Sprintf("Evacuating node %x: %d findnode failures", n.ID[:8], fails)) tab.delete(n) } } @@ -384,14 +383,15 @@ func (tab *Table) doRefresh(done chan struct{}) { // (hopefully) still alive. seeds := tab.db.querySeeds(seedCount, seedMaxAge) seeds = tab.bondall(append(seeds, tab.nursery...)) - if glog.V(logger.Debug) { - if len(seeds) == 0 { - glog.Infof("no seed nodes found") - } - for _, n := range seeds { + + if len(seeds) == 0 { + log.Debug(fmt.Sprintf("no seed nodes found")) + } + for _, n := range seeds { + log.Debug("", "msg", log.Lazy{Fn: func() string { age := time.Since(tab.db.lastPong(n.ID)) - glog.Infof("seed node (age %v): %v", age, n) - } + return fmt.Sprintf("seed node (age %v): %v", age, n) + }}) } tab.mutex.Lock() tab.stuff(seeds) @@ -470,7 +470,7 @@ func (tab *Table) bond(pinged bool, id NodeID, addr *net.UDPAddr, tcpPort uint16 var result error age := time.Since(tab.db.lastPong(id)) if node == nil || fails > 0 || age > nodeDBNodeExpiration { - glog.V(logger.Detail).Infof("Bonding %x: known=%t, fails=%d age=%v", id[:8], node != nil, fails, age) + log.Trace(fmt.Sprintf("Bonding %x: known=%t, fails=%d age=%v", id[:8], node != nil, fails, age)) tab.bondmu.Lock() w := tab.bonding[id] |