```
refactor(cool): 修复Logger变量名拼写错误 将全局Logger变量从Loger修正为Logger,统一日志实例命名规范, 确保所有模块中日志记录的一致性。 BREAKING CHANGE: 全局日志实例变量名从Loger改为Logger ```
This commit is contained in:
@@ -10,7 +10,7 @@ type TaskTest struct {
|
||||
}
|
||||
|
||||
func (t *TaskTest) Func(ctx g.Ctx, param string) error {
|
||||
cool.Loger.Info(ctx, "TaskTest Run ~~~~~~~~~~~~~~~~", param)
|
||||
cool.Logger.Info(ctx, "TaskTest Run ~~~~~~~~~~~~~~~~", param)
|
||||
return nil
|
||||
}
|
||||
func (t *TaskTest) IsSingleton() bool {
|
||||
|
||||
@@ -24,12 +24,12 @@ func EnableTask(ctx g.Ctx, cronId string, funcstring string, cron string, startD
|
||||
_, err = gcron.AddSingleton(ctx, cron, func(ctx g.Ctx) {
|
||||
nowDate := gtime.Now().Format("Y-m-d H:i:s")
|
||||
if nowDate < startDate {
|
||||
cool.Loger.Debug(ctx, "当前时间小于启用时间, 不执行单例函数", funcName)
|
||||
cool.Logger.Debug(ctx, "当前时间小于启用时间, 不执行单例函数", funcName)
|
||||
return
|
||||
}
|
||||
err := cool.RunFunc(ctx, funcstring)
|
||||
if err != nil {
|
||||
cool.Loger.Error(ctx, err)
|
||||
cool.Logger.Error(ctx, err)
|
||||
taskInfoService.Record(ctx, cronId, 0, err.Error())
|
||||
} else {
|
||||
taskInfoService.Record(ctx, cronId, 1, "任务执行成功")
|
||||
@@ -40,12 +40,12 @@ func EnableTask(ctx g.Ctx, cronId string, funcstring string, cron string, startD
|
||||
_, err = gcron.Add(ctx, cron, func(ctx g.Ctx) {
|
||||
nowDate := gtime.Now().Format("Y-m-d H:i:s")
|
||||
if nowDate < startDate {
|
||||
cool.Loger.Debug(ctx, "当前时间小于启用时间, 不执行函数", funcName)
|
||||
cool.Logger.Debug(ctx, "当前时间小于启用时间, 不执行函数", funcName)
|
||||
return
|
||||
}
|
||||
err := cool.RunFunc(ctx, funcstring)
|
||||
if err != nil {
|
||||
cool.Loger.Error(ctx, err)
|
||||
cool.Logger.Error(ctx, err)
|
||||
taskInfoService.Record(ctx, cronId, 0, gstr.AddSlashes(err.Error()))
|
||||
} else {
|
||||
taskInfoService.Record(ctx, cronId, 1, gstr.AddSlashes("任务执行成功"))
|
||||
|
||||
@@ -32,7 +32,7 @@ func NewTaskInfoService() *TaskInfoService {
|
||||
}
|
||||
|
||||
func (s *TaskInfoService) ModifyAfter(ctx g.Ctx, method string, param g.MapStrAny) (err error) {
|
||||
cool.Loger.Info(ctx, "TaskInfoService.ModifyAfter", method, param)
|
||||
cool.Logger.Info(ctx, "TaskInfoService.ModifyAfter", method, param)
|
||||
if method == "Add" {
|
||||
if gconv.Int(param["status"]) == 1 {
|
||||
id, err := cool.DBM(s.Model).Where("name", param["name"]).Value("id")
|
||||
@@ -169,7 +169,7 @@ func (s *TaskInfoService) SetNextRunTime(ctx g.Ctx, cronId string, cron string)
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
cool.Loger.Debug(ctx, "获取下次执行时间失败", e)
|
||||
cool.Logger.Debug(ctx, "获取下次执行时间失败", e)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -18,7 +18,7 @@ func init() {
|
||||
taskInfo = model.NewTaskInfo()
|
||||
ctx = gctx.GetInitCtx()
|
||||
)
|
||||
cool.Loger.Debug(ctx, "module task init start ...")
|
||||
cool.Logger.Debug(ctx, "module task init start ...")
|
||||
cool.FillInitData(ctx, "task", taskInfo, nil)
|
||||
|
||||
result, err := cool.DBM(taskInfo).Where("status", 1).All()
|
||||
@@ -29,6 +29,6 @@ func init() {
|
||||
id := v["id"].String()
|
||||
cool.RunFunc(ctx, "TaskAddTask("+id+")")
|
||||
}
|
||||
cool.Loger.Debug(ctx, "module task init finished ...")
|
||||
cool.Logger.Debug(ctx, "module task init finished ...")
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user