From 84cff6919a2a079aa6ad651832848c07495eabc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 30 Aug 2022 10:18:32 +0200 Subject: [PATCH] Worker: also log job UUID when running a task Having both the job and task UUIDs in the log output helps when debugging. --- internal/worker/task_executor.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/worker/task_executor.go b/internal/worker/task_executor.go index 91cc111a..2f9c3cde 100644 --- a/internal/worker/task_executor.go +++ b/internal/worker/task_executor.go @@ -48,7 +48,10 @@ func NewTaskExecutor(cmdRunner CommandRunner, listener TaskExecutionListener) *T // Run runs a task. // Returns ErrTaskReassigned when the task was reassigned to another worker. func (te *TaskExecutor) Run(ctx context.Context, task api.AssignedTask) error { - logger := log.With().Str("task", task.Uuid).Logger() + logger := log.With(). + Str("task", task.Uuid). + Str("job", task.Job). + Logger() logger.Info().Str("taskType", task.TaskType).Msg("starting task") if err := te.listener.TaskStarted(ctx, task.Uuid); err != nil {