Skip to content

Commit 01643d9

Browse files
committed
minor #8897 Don't use OutputInterface::VERBOSITY constants, use PHP methods instead (javiereguiluz)
This PR was merged into the 2.7 branch. Discussion ---------- Don't use OutputInterface::VERBOSITY constants, use PHP methods instead This article was the last place where we used the constants instead of the convenient shortcuts. Commits ------- 36f8174 Don't use OutputInterface::VERBOSITY constants, use PHP methods instead
2 parents b86e2f4 + 36f8174 commit 01643d9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

logging/monolog_console.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,18 @@ is passed when a command gets executed.
1616

1717
When a lot of logging has to happen, it's cumbersome to print information
1818
depending on the verbosity settings (``-v``, ``-vv``, ``-vvv``) because the
19-
calls need to be wrapped in conditions. The code quickly gets verbose or dirty.
20-
For example::
19+
calls need to be wrapped in conditions. For example::
2120

2221
use Symfony\Component\Console\Input\InputInterface;
2322
use Symfony\Component\Console\Output\OutputInterface;
2423

2524
protected function execute(InputInterface $input, OutputInterface $output)
2625
{
27-
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG) {
26+
if ($output->isDebug()) {
2827
$output->writeln('Some info');
2928
}
3029

31-
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
30+
if ($output->isVerbose()) {
3231
$output->writeln('Some more info');
3332
}
3433
}

0 commit comments

Comments
 (0)