Skip to content

Commit

Permalink
Merge pull request ipfs#75 from tvi/patch-1
Browse files Browse the repository at this point in the history
Fix logging of keys.
  • Loading branch information
Kubuxu authored Jul 31, 2017
2 parents 27c6861 + 3a8cbde commit 7b1fe37
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package dht
import (
"context"

cid "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log"
kb "github.com/libp2p/go-libp2p-kbucket"
peer "github.com/libp2p/go-libp2p-peer"
Expand All @@ -29,6 +30,12 @@ func toPeerInfos(ps []peer.ID) []*pstore.PeerInfo {
}

func loggableKey(k string) logging.LoggableMap {
cid, err := cid.Cast([]byte(k))
if err != nil {
log.Errorf("loggableKey could not cast key: %v", err)
} else {
k = cid.String()
}
return logging.LoggableMap{
"key": k,
}
Expand Down

0 comments on commit 7b1fe37

Please sign in to comment.