Skip to content

Commit

Permalink
Merge pull request #1017 from saikat-royc/fix-logs-2
Browse files Browse the repository at this point in the history
Add gRPC method name to logs
  • Loading branch information
k8s-ci-robot authored Dec 6, 2024
2 parents c8c8cd1 + 855d82a commit a0dd647
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/csi_driver/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,12 @@ func NewNodeServiceCapability(cap csi.NodeServiceCapability_RPC_Type) *csi.NodeS
}

func logGRPC(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
klog.V(3).Infof("GRPC call: %s", info.FullMethod)
klog.V(5).Infof("GRPC request: %+v", pbSanitizer.StripSecretsCSI03(req).String())
klog.V(5).Infof("GRPC call: %s, GRPC request: %+v", info.FullMethod, pbSanitizer.StripSecretsCSI03(req).String())
resp, err := handler(ctx, req)
if err != nil {
klog.Errorf("GRPC error: %v", err.Error())
klog.Errorf("GRPC call: %s, GRPC error: %v", info.FullMethod, err.Error())
} else {
klog.V(5).Infof("GRPC response: %+v", resp)
klog.V(5).Infof("GRPC call: %s, GRPC response: %+v", info.FullMethod, resp)
}
return resp, err
}
Expand Down

0 comments on commit a0dd647

Please sign in to comment.