作者 yangfu

fix:消息日志

@@ -5,6 +5,7 @@ import ( @@ -5,6 +5,7 @@ import (
5 "github.com/linmadan/egglib-go/utils/json" 5 "github.com/linmadan/egglib-go/utils/json"
6 "github.com/tal-tech/go-queue/kq" 6 "github.com/tal-tech/go-queue/kq"
7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant" 7 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
8 "strings" 9 "strings"
9 ) 10 )
10 11
@@ -32,7 +33,13 @@ func Push(topic string, o interface{}) error { @@ -32,7 +33,13 @@ func Push(topic string, o interface{}) error {
32 if pusher, ok = defaultClientMap[topic]; !ok { 33 if pusher, ok = defaultClientMap[topic]; !ok {
33 return fmt.Errorf("pusher client [%v] not found ", topic) 34 return fmt.Errorf("pusher client [%v] not found ", topic)
34 } 35 }
35 - return pusher.Push(json.MarshalToString(o)) 36 + if err := pusher.Push(json.MarshalToString(o)); err != nil {
  37 + log.Logger.Debug(fmt.Sprintf("Topic:%v error:%v", topic, err.Error()), map[string]interface{}{"value": o})
  38 + return err
  39 + } else {
  40 + log.Logger.Debug(fmt.Sprintf("Topic:%v 发送成功", topic), map[string]interface{}{"value": o})
  41 + }
  42 + return nil
36 } 43 }
37 44
38 // 新建一个推送对象 45 // 新建一个推送对象