Skip to content

Conversation

@smatyas
Copy link
Contributor

@smatyas smatyas commented Jun 28, 2016

Setting a message level like in the added example, was not yet documented. I just found out this method by looking into the code. I also tested with some dummy command that it really does what I thought:

protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln('quiet', OutputInterface::VERBOSITY_QUIET); $output->writeln('normal', OutputInterface::VERBOSITY_NORMAL); $output->writeln('verbose', OutputInterface::VERBOSITY_VERBOSE); $output->writeln('very verbose', OutputInterface::VERBOSITY_VERY_VERBOSE); $output->writeln('debug', OutputInterface::VERBOSITY_DEBUG); } 
@javiereguiluz
Copy link
Member

@smatyas I like it! However, lately in the docs we try to minimize the text and instead explain more things inside the code samples. So, what about moving your explanation to the above code example? Something like this:

 It is possible to print a message in a command for only a specific verbosity level. For example::  if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {  $output->writeln(...);  }  // alternatively you can pass the verbosity level to writeln()  $output->writeln('...', OutputInterface::VERBOSITY_VERBOSE);
@smatyas smatyas force-pushed the console-verbosity-level-usage branch from 365c870 to 58f0f09 Compare June 28, 2016 09:20
@smatyas
Copy link
Contributor Author

smatyas commented Jun 28, 2016

Thanks for the suggestion, applied and squashed.

@wouterj
Copy link
Member

wouterj commented Jun 29, 2016

👍 Note to the merger: this feature is introduced in 2.8, it should be merged into the 2.8 version of the docs.

Status: reviewed

@javiereguiluz
Copy link
Member

👍

xabbuh added a commit that referenced this pull request Jun 30, 2016
…vel usage. (smatyas) This PR was submitted for the 2.7 branch but it was merged into the 2.8 branch instead (closes #6690). Discussion ---------- Added an example for a different method of verbosity level usage. Setting a message level like in the added example, was not yet documented. I just found out this method by looking into the code. I also tested with some dummy command that it really does what I thought: ``` protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln('quiet', OutputInterface::VERBOSITY_QUIET); $output->writeln('normal', OutputInterface::VERBOSITY_NORMAL); $output->writeln('verbose', OutputInterface::VERBOSITY_VERBOSE); $output->writeln('very verbose', OutputInterface::VERBOSITY_VERY_VERBOSE); $output->writeln('debug', OutputInterface::VERBOSITY_DEBUG); } ``` Commits ------- cedfdc4 Added an example for a different method of verbosity level usage.
xabbuh added a commit that referenced this pull request Jun 30, 2016
@xabbuh
Copy link
Member

xabbuh commented Jun 30, 2016

Thank you @smatyas for adding the missing documentation for this nice feature. I have merged your PR into the 2.8 branch and added a versionadded directive in de9607d.

@xabbuh xabbuh closed this Jun 30, 2016
xabbuh added a commit that referenced this pull request Jun 30, 2016
xabbuh added a commit that referenced this pull request Jun 30, 2016
* 2.8: [#6597] some tweaks [Validator] Add shorter examples using the default option Typo fix Add missing parameter Updated the CS rule about return null; and return; [#6690] fix syntax error Update date.rst - Fixes typo [#6690] add versionadded directive Added an example for a different method of verbosity level usage. NullOutput should be passed to $command->run() Hard values for the driver option Fix ldap security examples
xabbuh added a commit that referenced this pull request Jun 30, 2016
* 3.0: [#6597] some tweaks [Validator] Add shorter examples using the default option Typo fix Add missing parameter Updated the CS rule about return null; and return; [#6690] fix syntax error Update date.rst - Fixes typo [#6690] add versionadded directive Added an example for a different method of verbosity level usage. NullOutput should be passed to $command->run() Hard values for the driver option Fix ldap security examples
xabbuh added a commit that referenced this pull request Jun 30, 2016
* 3.1: [#6597] some tweaks [Validator] Add shorter examples using the default option Typo fix Added the documentation for the Cache component Add missing parameter Updated the CS rule about return null; and return; [#6690] fix syntax error Update date.rst - Fixes typo [#6690] add versionadded directive Added an example for a different method of verbosity level usage. NullOutput should be passed to $command->run() Hard values for the driver option Fix ldap security examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

5 participants