Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an example for a different method of verbosity level usage. #6690

Closed
wants to merge 1 commit into from

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants