diff --git a/components/console/introduction.rst b/components/console/introduction.rst index d332b326835..776bf749c41 100755 --- a/components/console/introduction.rst +++ b/components/console/introduction.rst @@ -163,16 +163,22 @@ You can also set these colors and options inside the tagname:: Verbosity Levels ~~~~~~~~~~~~~~~~ -The console has 3 levels of verbosity. These are defined in the +.. versionadded:: 2.3 + The ``VERBOSITY_VERY_VERBOSE`` and ``VERBOSITY_DEBUG`` constants were introduced + in version 2.3 + +The console has 5 levels of verbosity. These are defined in the :class:`Symfony\\Component\\Console\\Output\\OutputInterface`: -================================== =============================== -Option Value -================================== =============================== -OutputInterface::VERBOSITY_QUIET Do not output any messages -OutputInterface::VERBOSITY_NORMAL The default verbosity level -OutputInterface::VERBOSITY_VERBOSE Increased verbosity of messages -================================== =============================== +======================================= ================================== +Option Value +======================================= ================================== +OutputInterface::VERBOSITY_QUIET Do not output any messages +OutputInterface::VERBOSITY_NORMAL The default verbosity level +OutputInterface::VERBOSITY_VERBOSE Increased verbosity of messages +OutputInterface::VERBOSITY_VERY_VERBOSE Informative non essential messages +OutputInterface::VERBOSITY_DEBUG Debug messages +======================================= ================================== You can specify the quiet verbosity level with the ``--quiet`` or ``-q`` option. The ``--verbose`` or ``-v`` option is used when you want an increased @@ -181,12 +187,12 @@ level of verbosity. .. tip:: The full exception stacktrace is printed if the ``VERBOSITY_VERBOSE`` - level is used. + level or above is used. It is possible to print a message in a command for only a specific verbosity level. For example:: - if (OutputInterface::VERBOSITY_VERBOSE === $output->getVerbosity()) { + if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { $output->writeln(...); } diff --git a/components/console/usage.rst b/components/console/usage.rst index ac7f0b8a2c1..1a73c276ab5 100755 --- a/components/console/usage.rst +++ b/components/console/usage.rst @@ -77,6 +77,14 @@ with: $ php app/console list --verbose $ php app/console list -v +The verbose flag can optionally take a value between 1 (default) and 3 to +output even more verbose messages: + + $ php app/console list --verbose=2 + $ php app/console list -vv + $ php app/console list --verbose=3 + $ php app/console list -vvv + If you set the optional arguments to give your application a name and version:: $application = new Application('Acme Console Application', '1.2');