Skip to content

Commit

Permalink
Tail improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
brendt committed May 26, 2024
1 parent 76c59d7 commit cb2150c
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/Commands/TailCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,31 @@ public function __construct(
private TailDebugLogCommand $tailDebugLogCommand,
private TailProjectLogCommand $tailProjectLogCommand,
private TailServerLogCommand $tailServerLogCommand,
) {
}
) {}

#[ConsoleCommand(
name: 'tail',
description: 'Tail multiple logs',
)]
public function __invoke(
#[ConsoleArgument(description: 'Include the debug log', aliases: ['-d'])]
?bool $debug = null,
#[ConsoleArgument(description: 'Include the project log', aliases: ['-p'])]
?bool $project = null,
#[ConsoleArgument(description: 'Include the server log', aliases: ['-s'])]
?bool $server = null
): void {
$shouldFilter = $debug !== null
|| $project !== null
|| $server !== null;
?bool $server = null,
#[ConsoleArgument(description: 'Include the debug log', aliases: ['-d'])]
?bool $debug = null,
): void
{
$shouldFilter =
$project !== null
|| $server !== null
|| $debug !== null;

/** @var array<array-key, \Tempest\Console\Commands\TailDebugLogCommand|\Tempest\Console\Commands\TailProjectLogCommand> $loggers */
$loggers = array_filter([
($shouldFilter === false || $debug) ? $this->tailDebugLogCommand : null,
($shouldFilter === false || $project) ? $this->tailProjectLogCommand : null,
($shouldFilter === false || $server) ? $this->tailServerLogCommand : null,
($shouldFilter === false || $debug) ? $this->tailDebugLogCommand : null,
]);

/** @var Fiber[] $fibers */
Expand Down

0 comments on commit cb2150c

Please sign in to comment.