From 31212676f24256568521150af94600224175b09d Mon Sep 17 00:00:00 2001 From: Vsevolod Brekelov Date: Tue, 15 Oct 2019 16:15:07 +0300 Subject: [PATCH] rpc: swap fmt to log for response handling --- pkg/rpc/request.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/rpc/request.go b/pkg/rpc/request.go index bc555a724..342baf3ba 100644 --- a/pkg/rpc/request.go +++ b/pkg/rpc/request.go @@ -2,7 +2,6 @@ package rpc import ( "encoding/json" - "fmt" "io" "net/http" @@ -114,7 +113,12 @@ func (r Request) writeServerResponse(w http.ResponseWriter, response Response) { encoder := json.NewEncoder(w) err := encoder.Encode(response) + logFields := log.Fields{ + "err": err, + "method": r.Method, + } + if err != nil { - fmt.Println(err) + log.WithFields(logFields).Error("Error encountered while encoding response") } }