From 14f4068e3e01d7002e6c5f66e964e004912a5a70 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 21 Nov 2022 15:00:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=AE=98=E7=BD=91=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=97=A5=E5=BF=97=E8=A1=A5=E5=85=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/gateway/agent.go | 4 ++-- modules/gateway/options.go | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) 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 }