From 993ec605c9f18d8eb1475d7e0ace2d3d32c5b322 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Wed, 6 Feb 2019 23:20:01 -0800 Subject: [PATCH] nit: add peer info when logging write errors Signed-off-by: Leo Chen --- p2p/host/hostv2/hostv2.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/p2p/host/hostv2/hostv2.go b/p2p/host/hostv2/hostv2.go index a00f9763f..7717757b9 100644 --- a/p2p/host/hostv2/hostv2.go +++ b/p2p/host/hostv2/hostv2.go @@ -190,7 +190,8 @@ func (host *HostV2) SendMessage(p p2p.Peer, message []byte) error { return p2p.ErrNewStream } if nw, err := s.Write(message); err != nil { - logger.Error("Write() failed", "error", err) + logger.Error("Write() failed", "peerID", p.PeerID, + "protocolID", ProtocolID, "error", err) return p2p.ErrMsgWrite } else if nw < len(message) { logger.Error("Short Write()", "expected", len(message), "actual", nw)