TYPO3 cli command: $ioV - easier verbose logging

revision e67bdc8973e44cd405b6e6910b14383c4e374725

raw

phork0.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
 
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
 
class MyCommand extends Command
{
    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $ioV = new SymfonyStyle($input, $output->isVerbose() ? $output : new NullOutput());
        $this->ioVV = new SymfonyStyle(
            $input,
            $output->isVeryVerbose() ? $output : new NullOutput()
        );
        $this->ioVVV = new SymfonyStyle($input, $output->isDebug() ? $output : new NullOutput());
 
        $this->ioV->writeln('message visible with -v only');
        $this->ioVV->writeln('message visible with -vv only');
        $this->ioVVV->writeln('message visible with -vvv only');
    }
}

History