From 8d928334b5d708ef7671f6e3642374d08878056c Mon Sep 17 00:00:00 2001 From: Jeromy Date: Wed, 10 Feb 2016 09:32:01 -0800 Subject: [PATCH] make PeerInfo loggable --- p2p/peer/peer.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/p2p/peer/peer.go b/p2p/peer/peer.go index e3544a126..e4a53d9f2 100644 --- a/p2p/peer/peer.go +++ b/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)