update log format --all replace
This commit is contained in:
@@ -3,10 +3,10 @@ package cron_service
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/robfig/cron/v3"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/unknwon/com"
|
||||
"message-nest/models"
|
||||
"message-nest/pkg/constant"
|
||||
"message-nest/pkg/logging"
|
||||
"message-nest/service/send_message_service"
|
||||
)
|
||||
|
||||
@@ -47,7 +47,7 @@ func (cs *CronService) InitLogsCronRun() {
|
||||
// 注册任务
|
||||
setting, err := models.GetSettingByKey(constant.LogsCleanSectionName, constant.LogsCleanCronKeyName)
|
||||
if err != nil {
|
||||
logging.Logger.Error(fmt.Sprintf("获取日志的cron失败,原因:%s", err))
|
||||
logrus.Error(fmt.Sprintf("获取日志的cron失败,原因:%s", err))
|
||||
}
|
||||
ClearLogsTaskId = AddTask(ScheduledTask{
|
||||
Schedule: setting.Value,
|
||||
@@ -57,7 +57,7 @@ func (cs *CronService) InitLogsCronRun() {
|
||||
// 添加任务
|
||||
err = models.AddSendTaskWithID("日志定时清除", constant.CleanLogsTaskId, "admin")
|
||||
if err != nil {
|
||||
logging.Logger.Error(fmt.Sprintf("添加日志定时清除任务失败,原因:%s", err))
|
||||
logrus.Error(fmt.Sprintf("添加日志定时清除任务失败,原因:%s", err))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ func (cs *CronService) UpdateLogsCronRun(cron string) {
|
||||
Schedule: cron,
|
||||
Job: ClearLogs,
|
||||
})
|
||||
logging.Logger.Error(fmt.Sprintf("更新日志的cron成功,%s", cron))
|
||||
logging.Logger.Error(fmt.Sprintf("所有的定时任务: %s", TaskList))
|
||||
logrus.Error(fmt.Sprintf("更新日志的cron成功,%s", cron))
|
||||
logrus.Error(fmt.Sprintf("所有的定时任务: %s", TaskList))
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ package cron_service
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/robfig/cron/v3"
|
||||
"message-nest/pkg/logging"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"sync"
|
||||
)
|
||||
|
||||
@@ -33,10 +34,10 @@ func AddTask(task ScheduledTask) cron.EntryID {
|
||||
taskId, err := CronInstance.AddFunc(task.Schedule, task.Job)
|
||||
if err != nil {
|
||||
// 处理错误
|
||||
logging.Logger.Error(fmt.Sprintf("添加定时任务失败,原因:%s", err))
|
||||
logrus.Error(fmt.Sprintf("添加定时任务失败,原因:%s", err))
|
||||
} else {
|
||||
TaskList[taskId] = &task
|
||||
logging.Logger.Error(fmt.Sprintf("添加定时任务成功,entryID: %d, cron: %s", taskId, task.Schedule))
|
||||
logrus.Error(fmt.Sprintf("添加定时任务成功,entryID: %d, cron: %s", taskId, task.Schedule))
|
||||
}
|
||||
return taskId
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user