1234567891011121314151617181920212223242526272829 |
- package middleware
- import (
- "context"
- "git.sxidc.com/service-supports/fslog"
- "google.golang.org/grpc"
- )
- func UnaryServerFsLogInterceptor() grpc.UnaryServerInterceptor {
- return func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
- resp, err := handler(ctx, req)
- if err != nil {
- fslog.Error(err)
- }
- return resp, err
- }
- }
- func StreamServerFsLogInterceptor() grpc.StreamServerInterceptor {
- return func(srv interface{}, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {
- err := handler(srv, stream)
- if err != nil {
- fslog.Error(err)
- }
- return err
- }
- }
|