Skip to content

Commit

Permalink
restore job id in worker command logs
Browse files Browse the repository at this point in the history
  • Loading branch information
L3o-pold committed Jul 20, 2022
1 parent 15c88fc commit 87d28b9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Illuminate/Queue/Console/WorkCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,17 +214,17 @@ protected function writeOutput(Job $job, $status)

$formattedStartedAt = Carbon::now()->format('Y-m-d H:i:s');

return $this->output->write(" <fg=gray>{$formattedStartedAt}</> {$job->resolveName()}");
return $this->output->write(" <fg=gray>{$formattedStartedAt} {$job->getJobId()}</> {$job->resolveName()}");
}

if ($this->latestStatus && $this->latestStatus != 'starting') {
$formattedStartedAt = Carbon::createFromTimestamp($this->latestStartedAt)->format('Y-m-d H:i:s');

$this->output->write(" <fg=gray>{$formattedStartedAt}</> {$job->resolveName()}");
$this->output->write(" <fg=gray>{$formattedStartedAt} {$job->getJobId()}</> {$job->resolveName()}");
}

$runTime = number_format((microtime(true) - $this->latestStartedAt) * 1000, 2).'ms';
$dots = max(terminal()->width() - mb_strlen($job->resolveName()) - mb_strlen($runTime) - 31, 0);
$runTime = number_format((microtime(true) - $this->latestStartedAt) * 1000, 2) . 'ms';
$dots = max(terminal()->width() - mb_strlen($job->resolveName().$runTime.$job->getJobId()) - 32, 0);

$this->output->write(' '.str_repeat('<fg=gray>.</>', $dots));
$this->output->write(" <fg=gray>$runTime</>");
Expand Down

0 comments on commit 87d28b9

Please sign in to comment.