Make logs cleaner by not logging public API errors in websocket

pull/436/head
Martin Boehm 2020-05-22 11:19:37 +02:00
parent 76324be8ec
commit bc001ce3a3
1 changed files with 3 additions and 1 deletions

View File

@ -420,7 +420,9 @@ func (s *WebsocketServer) onRequest(c *websocketChannel, req *websocketReq) {
glog.V(1).Info("Client ", c.id, " onRequest ", req.Method, " success")
s.metrics.WebsocketRequests.With(common.Labels{"method": req.Method, "status": "success"}).Inc()
} else {
glog.Error("Client ", c.id, " onMessage ", req.Method, ": ", errors.ErrorStack(err), ", data ", string(req.Params))
if apiErr, ok := err.(*api.APIError); !ok || !apiErr.Public {
glog.Error("Client ", c.id, " onMessage ", req.Method, ": ", errors.ErrorStack(err), ", data ", string(req.Params))
}
s.metrics.WebsocketRequests.With(common.Labels{"method": req.Method, "status": "failure"}).Inc()
e := resultError{}
e.Error.Message = err.Error()