Worker: also log job UUID when running a task

Having both the job and task UUIDs in the log output helps when debugging.
This commit is contained in:
Sybren A. Stüvel 2022-08-30 10:18:32 +02:00
parent c504e68d8e
commit 84cff6919a

View File

@ -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 {