mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-27 12:08:52 +08:00
1
This commit is contained in:
parent
3f739459db
commit
b14863aea6
@ -13,8 +13,7 @@ import (
|
|||||||
|
|
||||||
func ApiToRpc(c *gin.Context, apiReq, apiResp interface{}, rpcName string, rpcClientFunc interface{}, rpcFuncName string) {
|
func ApiToRpc(c *gin.Context, apiReq, apiResp interface{}, rpcName string, rpcClientFunc interface{}, rpcFuncName string) {
|
||||||
logFuncName := fmt.Sprintf("[ApiToRpc: %s]%s", utils2.GetFuncName(1), rpcFuncName)
|
logFuncName := fmt.Sprintf("[ApiToRpc: %s]%s", utils2.GetFuncName(1), rpcFuncName)
|
||||||
operationID := c.GetHeader("operationID")
|
nCtx := trace_log.NewCtx1(c, rpcFuncName)
|
||||||
nCtx := trace_log.NewCtx1(c, rpcFuncName, operationID)
|
|
||||||
defer log.ShowLog(nCtx)
|
defer log.ShowLog(nCtx)
|
||||||
if err := c.BindJSON(apiReq); err != nil {
|
if err := c.BindJSON(apiReq); err != nil {
|
||||||
trace_log.WriteErrorResponse(nCtx, "BindJSON", err)
|
trace_log.WriteErrorResponse(nCtx, "BindJSON", err)
|
||||||
|
@ -22,8 +22,8 @@ func NewCtx(c *gin.Context, api string) context.Context {
|
|||||||
return context.WithValue(c, TraceLogKey, req)
|
return context.WithValue(c, TraceLogKey, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewCtx1(c *gin.Context, api, operationID string) context.Context {
|
func NewCtx1(c *gin.Context, api string) context.Context {
|
||||||
req := &ApiInfo{ApiName: api, GinCtx: c, OperationID: operationID, Funcs: &[]FuncInfo{}}
|
req := &ApiInfo{ApiName: api, GinCtx: c, OperationID: c.GetHeader("operationID"), Funcs: &[]FuncInfo{}}
|
||||||
return context.WithValue(c, TraceLogKey, req)
|
return context.WithValue(c, TraceLogKey, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user