Skip to content

Commit

Permalink
Added ability to choose all 3 verbosity levels and moved stack traces…
Browse files Browse the repository at this point in the history
… to the 2nd one
  • Loading branch information
everzet committed Jan 16, 2014
1 parent 9717e0a commit d550f72
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Behat/Testwork/Exception/ExceptionPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function presentException(Exception $exception, $verbosity = OutputPrinte
return trim($this->relativizePaths($exception->getMessage()));
}

if (OutputPrinter::VERBOSITY_VERBOSE <= $verbosity) {
if (OutputPrinter::VERBOSITY_VERY_VERBOSE <= $verbosity) {
return $this->relativizePaths(trim($exception));
}

Expand Down
7 changes: 6 additions & 1 deletion src/Behat/Testwork/Output/Cli/OutputController.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,14 @@ protected function setFormattersParameters(InputInterface $input, OutputInterfac
}
}

if ($input->getOption('verbose')) {
if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || $input->getParameterOption('--verbose') === 3) {
$this->manager->setFormattersParameter('output_verbosity', OutputPrinter::VERBOSITY_DEBUG);
} elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || $input->getParameterOption('--verbose') === 2) {
$this->manager->setFormattersParameter('output_verbosity', OutputPrinter::VERBOSITY_VERY_VERBOSE);
} elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
$this->manager->setFormattersParameter('output_verbosity', OutputPrinter::VERBOSITY_VERBOSE);
}

if ($input->getOption('colors')) {
$output->setDecorated(true);
$this->manager->setFormattersParameter('output_decorate', true);
Expand Down
6 changes: 4 additions & 2 deletions src/Behat/Testwork/Output/Printer/OutputPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
*/
interface OutputPrinter
{
const VERBOSITY_NORMAL = 1;
const VERBOSITY_VERBOSE = 2;
const VERBOSITY_NORMAL = 1;
const VERBOSITY_VERBOSE = 2;
const VERBOSITY_VERY_VERBOSE = 3;
const VERBOSITY_DEBUG = 4;

/**
* Sets output path.
Expand Down

0 comments on commit d550f72

Please sign in to comment.