瀏覽代碼

update auth

master
DengBiao 1 年之前
父節點
當前提交
d7194a6e73
共有 1 個檔案被更改,包括 4 行新增11 行删除
  1. +4
    -11
      pkg/interceptor/interceptor.go

+ 4
- 11
pkg/interceptor/interceptor.go 查看文件

@@ -25,23 +25,16 @@ func NewInterceptor(name string, urlWhitelist map[string]int) grpc.UnaryServerIn
logger.Logger.Debug(name, zap.Any("method", info.FullMethod), zap.Any("md", md), zap.Any("req", req),
zap.Any("resp", resp), zap.Error(err))

//resp, err = handleWithAuth(ctx, req, info, handler, urlWhitelist)
//logger.Logger.Debug(name, zap.Any("method", info.FullMethod), zap.Any("md", md), zap.Any("req", req),
// zap.Any("resp", resp), zap.Error(err))

s, _ := status.FromError(err)
if s.Code() != 0 && s.Code() < 1000 {
md, _ := metadata.FromIncomingContext(ctx)
logger.Logger.Error(name, zap.String("method", info.FullMethod), zap.Any("md", md), zap.Any("req", req),
zap.Any("resp", resp), zap.Error(err), zap.String("stack", gerrors.GetErrorStack(s)))
}

resp, err = handleWithAuth(ctx, req, info, handler, urlWhitelist)
logger.Logger.Debug(name, zap.Any("method", info.FullMethod), zap.Any("md", md), zap.Any("req", req),
zap.Any("resp", resp), zap.Error(err))

ss, _ := status.FromError(err)
if ss.Code() != 0 && ss.Code() < 1000 {
md, _ := metadata.FromIncomingContext(ctx)
logger.Logger.Error(name, zap.String("method", info.FullMethod), zap.Any("md", md), zap.Any("req", req),
zap.Any("resp", resp), zap.Error(err), zap.String("stack", gerrors.GetErrorStack(ss)))
}
return
}
}


Loading…
取消
儲存