forked from TrueCloudLab/neoneo-go
rpc: extend error log message for failed RPC requests
Message is always non-empty; Data is allowed to be empty.
This commit is contained in:
parent
5108d1c2c7
commit
9488756437
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