From 013795041be8fbf4cd3db43a89e661e00599cc5b Mon Sep 17 00:00:00 2001 From: Yvan <8574526@qq,com> Date: Fri, 6 Nov 2026 02:14:26 +0800 Subject: [PATCH] fix: log task start and completion details --- internal/worker/task_scheduler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/worker/task_scheduler.go b/internal/worker/task_scheduler.go index 8ab92d4..5aaeea8 100644 --- a/internal/worker/task_scheduler.go +++ b/internal/worker/task_scheduler.go @@ -316,8 +316,12 @@ func (s *TaskScheduler) run(ctx context.Context, task *taskbiz.TimedTask, trigge logger.Error("timed task execution skipped because executor is unavailable", "task_id", taskID, "task_name", taskName, "trigger_type", trigger) return } + logger.InfoContext(ctx, "timed task started", "task_id", taskID, "task_name", taskName, "trigger_type", trigger) log := s.executor.Run(ctx, task, trigger) attributes := []any{"task_id", log.TaskID, "task_name", log.TaskName, "trigger_type", log.TriggerType, "status", log.Status, "duration_ms", log.DurationMS, "started_at", log.StartedAt, "finished_at", log.FinishedAt} + if log.Output != "" { + attributes = append(attributes, "output", log.Output) + } if log.ErrorMsg != "" { attributes = append(attributes, "error", log.ErrorMsg) }