Browse Source

make PeerInfo loggable

pull/14/head
Jeromy 9 years ago
parent
commit
8d928334b5
  1. 7
      p2p/peer/peer.go

7
p2p/peer/peer.go

@ -141,6 +141,13 @@ type PeerInfo struct {
Addrs []ma.Multiaddr
}
func (pi *PeerInfo) Loggable() map[string]interface{} {
return map[string]interface{}{
"peerID": pi.ID.Pretty(),
"addrs": pi.Addrs,
}
}
func (pi *PeerInfo) MarshalJSON() ([]byte, error) {
out := make(map[string]interface{})
out["ID"] = IDB58Encode(pi.ID)

Loading…
Cancel
Save