(s *Service)
| 135 | } |
| 136 | |
| 137 | func LoggingInterceptor(s *Service) grpc.UnaryServerInterceptor { |
| 138 | return func( |
| 139 | ctx context.Context, |
| 140 | req interface{}, |
| 141 | info *grpc.UnaryServerInfo, |
| 142 | handler grpc.UnaryHandler, |
| 143 | ) (interface{}, error) { |
| 144 | // Handle the request |
| 145 | resp, err := handler(ctx, req) |
| 146 | |
| 147 | // Log the request |
| 148 | logRequest(ctx, info.FullMethod, err) |
| 149 | |
| 150 | // Track successful requests |
| 151 | if err == nil { |
| 152 | s.NewRequest() |
| 153 | } |
| 154 | |
| 155 | return resp, err |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | func LoggingStreamInterceptor(s *Service) grpc.StreamServerInterceptor { |
| 160 | return func( |
no test coverage detected