提交 80bc9251 作者: Brian Tiger Chow

style(peer) shorter ID when printing Peer

feel free to contest/revert if this becomes a problem

License: MIT
Signed-off-by: 's avatarBrian Tiger Chow <brian@perfmode.com>
上级 b799ddef
...@@ -161,11 +161,11 @@ type peer struct { ...@@ -161,11 +161,11 @@ type peer struct {
// codebase is known to be correct. // codebase is known to be correct.
func (p *peer) String() string { func (p *peer) String() string {
pid := p.id.String() pid := p.id.String()
maxRunes := 12 maxRunes := 6
if len(pid) < maxRunes { if len(pid) < maxRunes {
maxRunes = len(pid) maxRunes = len(pid)
} }
return "[Peer " + pid[:maxRunes] + "]" return fmt.Sprintf("peer %s", pid[:maxRunes])
} }
func (p *peer) Loggable() map[string]interface{} { func (p *peer) Loggable() map[string]interface{} {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论