Skip to content

Commit

Permalink
Merge pull request #130 from icey-yu/fix-rpclog
Browse files Browse the repository at this point in the history
fix: rpc log print
  • Loading branch information
icey-yu committed Sep 2, 2024
2 parents f2159aa + 97e6470 commit f8f5108
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion mw/rpc_client_interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package mw

import (
"context"
"errors"
"fmt"
"strings"

Expand Down Expand Up @@ -46,8 +47,11 @@ func RpcClientInterceptor(ctx context.Context, method string, req, resp any, cc
if err == nil {
log.ZInfo(ctx, fmt.Sprintf("RPC Client Response Success - %s", extractFunctionName(method)), "funcName", method, "resp", resp)
return nil
} else if errors.Is(err, errs.ErrRecordNotFound) {
log.ZWarn(ctx, fmt.Sprintf("RPC Client Response Error - %s", extractFunctionName(method)), err, "funcName", method)
} else {
log.ZError(ctx, fmt.Sprintf("RPC Client Response Error - %s", extractFunctionName(method)), err, "funcName", method)
}
log.ZError(ctx, fmt.Sprintf("RPC Client Response Error - %s", extractFunctionName(method)), err, "funcName", method)
rpcErr, ok := err.(interface{ GRPCStatus() *status.Status })
if !ok {
return errs.ErrInternalServer.WrapMsg(err.Error())
Expand Down

0 comments on commit f8f5108

Please sign in to comment.