Skip to content

Commit 1831e26

Browse files
authored
[12.x] Display job queue names when running queue:work with --verbose option (#56086)
1 parent 9f03dc6 commit 1831e26

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Illuminate/Queue/Console/WorkCommand.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,20 +228,22 @@ protected function writeOutput(Job $job, $status, ?Throwable $exception = null)
228228
*/
229229
protected function writeOutputForCli(Job $job, $status)
230230
{
231-
$this->output->write(sprintf(
232-
' <fg=gray>%s</> %s%s',
231+
$isVerbose = $this->output->isVerbose();
232+
233+
$this->output->write(rtrim(sprintf(
234+
' <fg=gray>%s</> %s %s',
233235
$this->now()->format('Y-m-d H:i:s'),
234236
$job->resolveName(),
235-
$this->output->isVerbose()
236-
? sprintf(' <fg=gray>%s</>', $job->getJobId())
237+
$isVerbose
238+
? sprintf('<fg=gray>%s</> <fg=blue>%s</>', $job->getJobId(), $job->getQueue())
237239
: ''
238-
));
240+
)));
239241

240242
if ($status == 'starting') {
241243
$this->latestStartedAt = microtime(true);
242244

243245
$dots = max(terminal()->width() - mb_strlen($job->resolveName()) - (
244-
$this->output->isVerbose() ? (mb_strlen($job->getJobId()) + 1) : 0
246+
$isVerbose ? mb_strlen($job->getJobId()) + mb_strlen($job->getQueue()) + 2 : 0
245247
) - 33, 0);
246248

247249
$this->output->write(' '.str_repeat('<fg=gray>.</>', $dots));
@@ -252,7 +254,7 @@ protected function writeOutputForCli(Job $job, $status)
252254
$runTime = $this->runTimeForHumans($this->latestStartedAt);
253255

254256
$dots = max(terminal()->width() - mb_strlen($job->resolveName()) - (
255-
$this->output->isVerbose() ? (mb_strlen($job->getJobId()) + 1) : 0
257+
$isVerbose ? mb_strlen($job->getJobId()) + mb_strlen($job->getQueue()) + 2 : 0
256258
) - mb_strlen($runTime) - 31, 0);
257259

258260
$this->output->write(' '.str_repeat('<fg=gray>.</>', $dots));

0 commit comments

Comments
 (0)