From 96ae35e2ac8c360781407d7294081aabdcbb3652 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 24 Feb 2017 09:58:04 +0100 Subject: p2p, p2p/discover, p2p/nat: rework logging using context keys --- p2p/discover/node.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'p2p/discover/node.go') diff --git a/p2p/discover/node.go b/p2p/discover/node.go index f0262762e..6a7ab814e 100644 --- a/p2p/discover/node.go +++ b/p2p/discover/node.go @@ -221,6 +221,11 @@ func (n NodeID) GoString() string { return fmt.Sprintf("discover.HexID(\"%x\")", n[:]) } +// TerminalString returns a shortened hex string for terminal logging. +func (n NodeID) TerminalString() string { + return hex.EncodeToString(n[:8]) +} + // HexID converts a hex string to a NodeID. // The string may be prefixed with 0x. func HexID(in string) (NodeID, error) { -- cgit v1.2.3