From 1bed0e1cecc21294580e3447516a90d4b3e270a7 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期四, 29 六月 2023 19:47:08 +0800 Subject: [PATCH] 生产任务单响应添加物料编号 --- nsqclient/client.go | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nsqclient/client.go b/nsqclient/client.go index 46f5911..097933f 100644 --- a/nsqclient/client.go +++ b/nsqclient/client.go @@ -2,9 +2,9 @@ import ( "context" - "fmt" "kingdee-dbapi/config" + "kingdee-dbapi/logger" ) var producerCli Producer @@ -14,7 +14,7 @@ var err error producerCli, err = NewProducer(config.Options.NsqServer) if err != nil { - fmt.Println(err.Error()) + logger.Error("鍒涘缓nsq鐢熶骇瀹㈡埛绔け璐�, %s", err.Error()) } return err @@ -24,14 +24,14 @@ if producerCli == nil { err := InitNsqProducer() if err != nil { - fmt.Println("Init Nsq Client error:" + err.Error()) + logger.Error("鍒涘缓nsq鐢熶骇瀹㈡埛绔け璐�, %s", err.Error()) return false } } err := producerCli.Publish(topic, msg) if err != nil { - fmt.Println("Publish error:" + err.Error()) + logger.Error("nsp鍙戝竷娑堟伅澶辫触,涓婚:%s, %s", topic, err.Error()) } return err == nil @@ -39,12 +39,12 @@ func InitNsqConsumer(topic, channel string, handle func(data []byte) error) { if c, err := NewNsqConsumer(context.Background(), topic, channel); err != nil { - fmt.Println("NewNsqConsumer failed", err) + logger.Error("鍒涘缓nsq娑堣垂瀹㈡埛绔け璐�, %s", err.Error()) return } else { c.AddHandler(handle) if err := c.Run(config.Options.NsqServer, 1); err != nil { - fmt.Println("run consumer failed", err) + logger.Error("杩愯nsq娑堣垂瀹㈡埛绔け璐�, %s", err.Error()) } } -- Gitblit v1.8.0