Skip to content

Commit

Permalink
Gossip/discovery: add String() to NetworkMember
Browse files Browse the repository at this point in the history
This commit simply adds a String() method to NetworkMember,
because otherwise- the struct is printed without its field names
and it's hard to figure out which refers to what.

Change-Id: I5ea6552b79afa21b3222ebe1b7b22349851b653a
Signed-off-by: Yacov Manevich <yacovm@il.ibm.com>
  • Loading branch information
yacovm committed Mar 12, 2017
1 parent b3d3254 commit 061a1e8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gossip/discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package discovery

import (
"fmt"

"github.com/hyperledger/fabric/gossip/common"
proto "github.com/hyperledger/fabric/protos/gossip"
)
Expand Down Expand Up @@ -80,6 +82,11 @@ type NetworkMember struct {
InternalEndpoint string
}

// String returns a string representation of the NetworkMember
func (n *NetworkMember) String() string {
return fmt.Sprintf("Endpoint: %s, InternalEndpoint: %s, PKI-ID: %v, Metadata: %v", n.Endpoint, n.InternalEndpoint, n.PKIid, n.Metadata)
}

// PreferredEndpoint computes the endpoint to connect to,
// while preferring internal endpoint over the standard
// endpoint
Expand Down

0 comments on commit 061a1e8

Please sign in to comment.