aboutsummaryrefslogtreecommitdiffstats
path: root/p2p/discover/database.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2017-02-24 16:58:04 +0800
committerFelix Lange <fjl@twurst.com>2017-02-28 17:20:29 +0800
commit96ae35e2ac8c360781407d7294081aabdcbb3652 (patch)
tree378cc7aae99127a4e85a721e5cd319ced87e103a /p2p/discover/database.go
parent35e8308bf76df11c3c1e8d11fac782814583ea5c (diff)
downloadgo-tangerine-96ae35e2ac8c360781407d7294081aabdcbb3652.tar
go-tangerine-96ae35e2ac8c360781407d7294081aabdcbb3652.tar.gz
go-tangerine-96ae35e2ac8c360781407d7294081aabdcbb3652.tar.bz2
go-tangerine-96ae35e2ac8c360781407d7294081aabdcbb3652.tar.lz
go-tangerine-96ae35e2ac8c360781407d7294081aabdcbb3652.tar.xz
go-tangerine-96ae35e2ac8c360781407d7294081aabdcbb3652.tar.zst
go-tangerine-96ae35e2ac8c360781407d7294081aabdcbb3652.zip
p2p, p2p/discover, p2p/nat: rework logging using context keys
Diffstat (limited to 'p2p/discover/database.go')
-rw-r--r--p2p/discover/database.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/p2p/discover/database.go b/p2p/discover/database.go
index a8b32d31e..7206a63c6 100644
--- a/p2p/discover/database.go
+++ b/p2p/discover/database.go
@@ -23,7 +23,6 @@ import (
"bytes"
"crypto/rand"
"encoding/binary"
- "fmt"
"os"
"sync"
"time"
@@ -180,12 +179,11 @@ func (db *nodeDB) storeInt64(key []byte, n int64) error {
func (db *nodeDB) node(id NodeID) *Node {
blob, err := db.lvl.Get(makeKey(id, nodeDBDiscoverRoot), nil)
if err != nil {
- log.Trace(fmt.Sprintf("failed to retrieve node %v: %v", id, err))
return nil
}
node := new(Node)
if err := rlp.DecodeBytes(blob, node); err != nil {
- log.Warn(fmt.Sprintf("failed to decode node RLP: %v", err))
+ log.Error("Failed to decode node RLP", "err", err)
return nil
}
node.sha = crypto.Keccak256Hash(node.ID[:])
@@ -233,7 +231,7 @@ func (db *nodeDB) expirer() {
select {
case <-tick:
if err := db.expireNodes(); err != nil {
- log.Error(fmt.Sprintf("Failed to expire nodedb items: %v", err))
+ log.Error("Failed to expire nodedb items", "err", err)
}
case <-db.quit:
@@ -352,7 +350,7 @@ func nextNode(it iterator.Iterator) *Node {
}
var n Node
if err := rlp.DecodeBytes(it.Value(), &n); err != nil {
- log.Warn(fmt.Sprintf("invalid node %x: %v", id, err))
+ log.Warn("Failed to decode node RLP", "id", id, "err", err)
continue
}
return &n