正在显示
1 个修改的文件
包含
8 行增加
和
1 行删除
@@ -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 | // 新建一个推送对象 |
-
请 注册 或 登录 后发表评论