diff --git a/modules/gateway/agent.go b/modules/gateway/agent.go index 909af6305..59181cb3c 100644 --- a/modules/gateway/agent.go +++ b/modules/gateway/agent.go @@ -270,14 +270,14 @@ func (this *Agent) messageDistribution(msg *pb.UserMessage) (err error) { if len(serviceTag) == 0 { if err = this.gateway.Service().RpcCall(context.Background(), servicePath, string(comm.Rpc_GatewayRoute), req, reply); err != nil { this.gateway.Error("[UserResponse]", - log.Fields{"uid": this.uId, "req": req.String(), "err": err.Error()}, + log.Fields{"uid": this.uId, "serviceTag": serviceTag, "servicePath": servicePath, "req": req.String(), "err": err.Error()}, ) return } } else { //跨集群调用 if err = this.gateway.Service().AcrossClusterRpcCall(context.Background(), serviceTag, servicePath, string(comm.Rpc_GatewayRoute), req, reply); err != nil { this.gateway.Error("[UserResponse]", - log.Fields{"uid": this.uId, "req": req.String(), "err": err.Error()}, + log.Fields{"uid": this.uId, "serviceTag": serviceTag, "servicePath": servicePath, "req": req.String(), "err": err.Error()}, ) return } diff --git a/modules/gateway/options.go b/modules/gateway/options.go index e47f55b3e..c4ed54b02 100644 --- a/modules/gateway/options.go +++ b/modules/gateway/options.go @@ -1,6 +1,8 @@ package gateway import ( + "errors" + "go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/utils/mapstructure" "go_dreamfactory/modules" ) @@ -26,5 +28,8 @@ func (this *Options) LoadConfig(settings map[string]interface{}) (err error) { } err = mapstructure.Decode(settings, this) } + if this.Log = log.NewTurnlog(this.Debug, log.Clone("", 4)); this.Log == nil { + err = errors.New("log is nil") + } return }