Skip to content

[2.2][Console] Added more verbosity levels. See GH #6066 #6084

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

Closed
wants to merge 5 commits into from

Conversation

dlsniper
Copy link
Contributor

Bug fix: no
Feature addition: yes
Backwards compatibility break: yes, breaks the interface
Symfony2 tests pass: yes
Fixes the following tickets: #6066
Todo: documentation?
License of the code: MIT
Documentation PR: ~

See the request in #6066.


case $input->hasParameterOption(array('--verbose-debug', '-vvv')) :
$output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to say I don't quite see the advantage of this weird case evaluate me this vs the if/elseif that was there before. More lines and awkwardness for no benefit (that I can see).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only do this type of switch(true) when it adds more readability to the code instead of having the whole bunch of elseif () lines followed by the long line again and so on as it allows for better separation when going quickly thru the code.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @Seldaek that ifs would be better.

@Seldaek
Copy link
Member

Seldaek commented Nov 22, 2012

Cool thanks, did you try out if -vv works though? I was wondering if that would blow up the console or not.

@stof
Copy link
Member

stof commented Nov 22, 2012

This simply does not work. You cannot pass the option --verbose-debug as it is not in the input definition and so will explode when validating the input.

@dlsniper
Copy link
Contributor Author

Hi, I haven't tried it yet unfortunately and my schedule has just been messed up by my work. I'll update this asap, most likely next Monday.

@dlsniper
Copy link
Contributor Author

Thanks to @stof I've added the missing definition for the new input values and now everything should work properly.

@dlsniper
Copy link
Contributor Author

dlsniper commented Dec 8, 2012

Converted to ifs and squashed :)

new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message.'),
new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message.'),
new InputOption('--verbose', '-v', InputOption::VALUE_NONE, 'Increase verbosity of messages.'),
new InputOption('--verbose-very', '-vv', InputOption::VALUE_NONE, 'Increase verbosity of messages to display even more verbose messages.'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there has to be a criteria dividing certain messages from others that would explain this better, rather than just saying much more

@cordoval
Copy link
Contributor

cordoval commented Dec 9, 2012

maybe rather than say much more verbosity we should have all verbosity?

@dlsniper
Copy link
Contributor Author

dlsniper commented Dec 9, 2012

Like @Seldaek said, I'm not really good at naming this.

@dlsniper
Copy link
Contributor Author

@fabpot is there something that prevents this from going into master? If it's naming, I'm sure someone else could provide a better naming for it. The build failed due to some rather strange condition but unrelated to the changes done.

@Tobion
Copy link
Contributor

Tobion commented Dec 11, 2012

Why is it needed? Who draws / how to draw a line between verbose and very verbose?

@dlsniper
Copy link
Contributor Author

Think of the way you do logging where you have multiple levels.
If you want to use this in the console for user output/debugging/whatnot then you need to flag this somehow.
Also I really don't think we need a ruling on what's the appropriate level of verbosity for everything, just like we don't have a guideline for marking which output is info and which is critical. Users have to decided for themselves when it's the case to use one or the other.

As for a quick example, not the brightest star in the Universe but it's very late here:
I want to display:

  • normal: Download in progress
  • verbose: Download in progress: x%
  • very verbose: Download in progress: x% speed y
  • verbose debug: Connecting to HOST Connected to HOST ... Download in progress: x% speed y

@Tobion
Copy link
Contributor

Tobion commented Dec 11, 2012

Yeah I know the use case. But I wonder if it's really made use of by users. Because they usually don't want any extra information when everything is ok. Or they want to see all information that is available. Levels in between are probably not that common.
Looking at some verbosity of other well known command line interfaces, I figured there are some that only have a single -v, some that have multiple like -v, -vv as suggested here and some even have -v{int}. Then again one could also add a quite flag -q so nothing is printed except errors.
All in all, there is no standard way.

@stof
Copy link
Member

stof commented Dec 12, 2012

@Tobion we already have the quiet flag...
And for the different levels, this idea came from composer. Currently, you can put the output in verbose mode, getting the normal output plus the changelog for updated versions (which is great) and the git output (a bit less useful). But some people are asking to get the detailed report about decisions made by the solver to understand why some packages have been selected (or why they are conflicting). This would require another verbosity level to keep composer usable.

@fabpot
Copy link
Member

fabpot commented Dec 12, 2012

For the composer use case, I think a debug mode would be better:

  • -q: quiet, output nothing
  • -v: useful information
  • -d: debug more where a lot of not-so interesting stuff are displayed

@Seldaek
Copy link
Member

Seldaek commented Dec 12, 2012

I just think -vv/-vvv is a more common paradigm than --debug. People actually try it and get no result. Also it is just a verbosity change in the way that it gives you more verbose output. I think it's good to consolidate it all in one v/vv/vvv. 3 levels should be enough for most purposes really.

@dlsniper
Copy link
Contributor Author

👍 to @Seldaek

@fabpot
Copy link
Member

fabpot commented Dec 14, 2012

ok, let's find good names now. So this PR uses:

  • --verbose
  • --verbose-very
  • --verbose-debug

I'm not fan of these names. Here are some ideas:

  • --verbose
  • --more-verbose
  • --even-more-verbose

@Seldaek
Copy link
Member

Seldaek commented Dec 14, 2012

How about --verbose=1/2/3 (with --verbose being equivalent to --verbose=1) and -v/-vv/-vvv?

@dlsniper
Copy link
Contributor Author

Any preferences?

@dlsniper
Copy link
Contributor Author

dlsniper commented Jan 2, 2013

@fabpot should I change the names to the one mentioned by you so that this can be merged?
Or, taking the idea from @Seldaek, should we have:

  • --verbose=normal
  • --verbose=high
  • --verbose=debug

@dlsniper
Copy link
Contributor Author

dlsniper commented Feb 7, 2013

ping @fabpot @Seldaek can we agree on naming this? I'll be using it in production here soon and I'd rather not mess around with names after our internal release.

@extesy
Copy link

extesy commented Feb 26, 2013

@fabpot @dlsniper I would recommend having a digital verbosity level (same as what @Seldaek suggested) in addition to -vvv shortcuts. This scales much better in case if one more verbosity level is needed later. Also it seems to be a more common pattern around the internet, for example here or here, etc.

@Seldaek
Copy link
Member

Seldaek commented Apr 6, 2013

@fabpot can we have feedback from you? Is --verbose=1/2/3 (with --verbose being equivalent to --verbose=1) and -v/-vv/-vvv alright? I'd like to get this moved forward.

@fabpot
Copy link
Member

fabpot commented Apr 7, 2013

@Seldaek Your proposal looks good to me.

@Seldaek
Copy link
Member

Seldaek commented Apr 7, 2013

OK cool, @dlsniper do you have some time to work on updating this?

franmomu and others added 2 commits April 8, 2013 00:02
This PR was merged into the 2.2 branch.

Discussion
----------

[PropertyAccess] Add objectives to pluralMap

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#7483
| License       | MIT
| Doc PR        |

Commits
-------

6ef92fd [PropertyAccess] Add objectives to pluralMap
@dlsniper
Copy link
Contributor Author

dlsniper commented Apr 8, 2013

Hey, I'll do this and the doc PR in a day or two tops.

fabpot and others added 2 commits April 8, 2013 16:57
This PR was merged into the 2.2 branch.

Discussion
----------

[Security] Removed unused var

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | I guess
| Fixed tickets | -

Commits
-------

bd26419 [Security] Removed unused var
@dlsniper dlsniper closed this Apr 11, 2013
@Seldaek
Copy link
Member

Seldaek commented Apr 11, 2013

@dlsniper new PR coming or why did you close?

@dlsniper
Copy link
Contributor Author

@Seldaek yes, seems I've pushed the wrong button then but a new PR for this will come soon, working on it right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants