Merge pull request #2560 from nspcc-dev/rpc/extend-logging
rpc: extend error log message for failed RPC requests
This commit is contained in:
commit
ea69b72cd8
1 changed files with 4 additions and 1 deletions
|
@ -2260,7 +2260,10 @@ func (s *Server) packResponse(r *request.In, result interface{}, respErr *respon
|
||||||
// logRequestError is a request error logger.
|
// logRequestError is a request error logger.
|
||||||
func (s *Server) logRequestError(r *request.Request, jsonErr *response.Error) {
|
func (s *Server) logRequestError(r *request.Request, jsonErr *response.Error) {
|
||||||
logFields := []zap.Field{
|
logFields := []zap.Field{
|
||||||
zap.String("cause", jsonErr.Data),
|
zap.Int64("code", jsonErr.Code),
|
||||||
|
}
|
||||||
|
if len(jsonErr.Data) != 0 {
|
||||||
|
logFields = append(logFields, zap.String("cause", jsonErr.Data))
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.In != nil {
|
if r.In != nil {
|
||||||
|
|
Loading…
Reference in a new issue