update log format --all replace

This commit is contained in:
engigu
2024-01-13 12:04:40 +08:00
parent c0241df60c
commit e76782451b
9 changed files with 41 additions and 37 deletions
+4 -3
View File
@@ -1,8 +1,9 @@
package send_message_service
import (
"github.com/sirupsen/logrus"
"message-nest/pkg/constant"
"message-nest/pkg/logging"
"sync"
)
@@ -13,7 +14,7 @@ func DoSendTask(task SendMessageService, wg *sync.WaitGroup) {
defer wg.Done()
defer func() {
if r := recover(); r != nil {
logging.Logger.Error("DoSendTask: Recovered from panic:", r)
logrus.Error("DoSendTask: Recovered from panic:", r)
}
}()
@@ -31,7 +32,7 @@ func MessageConsumer(wg *sync.WaitGroup) {
for {
task, ok := <-Buffer
if !ok {
logging.Logger.Error("MessageConsumer: Channel closed. Exiting.")
logrus.Error("MessageConsumer: Channel closed. Exiting.")
return
}
+5 -5
View File
@@ -2,8 +2,8 @@ package send_message_service
import (
"fmt"
"github.com/sirupsen/logrus"
"message-nest/models"
"message-nest/pkg/logging"
"message-nest/service/send_task_service"
"message-nest/service/send_way_service"
"strings"
@@ -38,7 +38,7 @@ func (sm *SendMessageService) LogsAndStatusMark(errStr string, status int) {
if status == SendFail {
sm.Status = SendFail
}
logging.Logger.Error(fmt.Sprintf("%s, 状态:%d", errStr, status))
logrus.Error(fmt.Sprintf("%s, 状态:%d", errStr, status))
}
// Send 发送一个消息任务的所有实例
@@ -158,7 +158,7 @@ func (sm *SendMessageService) RecordSendLog() {
}
err := log.Add()
if err != nil {
logging.Logger.Error(fmt.Sprintf("添加日志失败!原因是:%s", err))
logrus.Error(fmt.Sprintf("添加日志失败!原因是:%s", err))
}
}
@@ -182,10 +182,10 @@ func (sm *SendMessageService) GetSendMsg(ins models.SendTasksIns) (string, strin
if !ok || len(content) == 0 {
content, ok := data["text"]
if !ok {
logging.Logger.Error("text节点数据为空!")
logrus.Error("text节点数据为空!")
return "text", ""
} else {
logging.Logger.Error(fmt.Sprintf("没有找到%s对应的消息,使用text消息替代!", ins.ContentType))
logrus.Error(fmt.Sprintf("没有找到%s对应的消息,使用text消息替代!", ins.ContentType))
return "text", content
}
} else {