diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-02-28 18:22:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-28 18:22:05 +0800 |
commit | 965407f2388b4da18fcc65f1e2caab3fdf5718e7 (patch) | |
tree | 6bc5102c4bc17b821aac9e7211f292d7325f900f /p2p/discover/node.go | |
parent | dc0a006c7cc4bb1a9690924bf0fd7a7da9d36384 (diff) | |
parent | 96ae35e2ac8c360781407d7294081aabdcbb3652 (diff) | |
download | dexon-965407f2388b4da18fcc65f1e2caab3fdf5718e7.tar dexon-965407f2388b4da18fcc65f1e2caab3fdf5718e7.tar.gz dexon-965407f2388b4da18fcc65f1e2caab3fdf5718e7.tar.bz2 dexon-965407f2388b4da18fcc65f1e2caab3fdf5718e7.tar.lz dexon-965407f2388b4da18fcc65f1e2caab3fdf5718e7.tar.xz dexon-965407f2388b4da18fcc65f1e2caab3fdf5718e7.tar.zst dexon-965407f2388b4da18fcc65f1e2caab3fdf5718e7.zip |
Merge pull request #3709 from fjl/p2p-context-log
p2p, p2p/discover, p2p/nat: rework logging using context keys
Diffstat (limited to 'p2p/discover/node.go')
-rw-r--r-- | p2p/discover/node.go | 5 |
1 files changed, 5 insertions, 0 deletions
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) { |