Added --debug flag to combine all the debug flags
We have also made it so if you use --logfile flag the output to console is suppressed to reduce noise.
This commit is contained in:
@@ -77,6 +77,15 @@ class Cli extends Application
|
||||
)
|
||||
);
|
||||
|
||||
$definition->addOption(
|
||||
new InputOption(
|
||||
'debug',
|
||||
null,
|
||||
InputOption::VALUE_NONE,
|
||||
'Turn on the <comment>-vvv --context --trace</comment> flags.'
|
||||
)
|
||||
);
|
||||
|
||||
return $definition;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,16 @@ class Command extends BaseCommand
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
if ($input->hasOption('debug') && $input->getOption('debug')) {
|
||||
$input->setOption('context', true);
|
||||
$input->setOption('trace', true);
|
||||
$input->setOption('verbose', true);
|
||||
if (function_exists('putenv')) {
|
||||
@putenv('SHELL_VERBOSITY=3');
|
||||
}
|
||||
$output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
|
||||
}
|
||||
|
||||
if ($input->hasOption('context') && true === $input->getOption('context')) {
|
||||
Config::save('logs.context', true);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ class ExportCommand extends Command
|
||||
protected function process(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
if (null !== ($logfile = $input->getOption('logfile')) && true === ($this->logger instanceof Logger)) {
|
||||
$this->logger->pushHandler(new StreamLogHandler(new Stream($logfile, 'a'), $output));
|
||||
$this->logger->setHandlers([new StreamLogHandler(new Stream($logfile, 'w'), $output)]);
|
||||
}
|
||||
|
||||
// -- Use Custom servers.yaml file.
|
||||
|
||||
@@ -239,7 +239,7 @@ class ImportCommand extends Command
|
||||
protected function process(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
if (null !== ($logfile = $input->getOption('logfile')) && true === ($this->logger instanceof Logger)) {
|
||||
$this->logger->pushHandler(new StreamLogHandler(new Stream($logfile, 'a'), $output));
|
||||
$this->logger->setHandlers([new StreamLogHandler(new Stream($logfile, 'w'), $output)]);
|
||||
}
|
||||
|
||||
// -- Use Custom servers.yaml file.
|
||||
|
||||
Reference in New Issue
Block a user