feat(occ): Add a --debug option to output all log levels to the output

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet
2024-06-25 17:03:19 +02:00
parent 72b6db4043
commit 2ba0819243
5 changed files with 62 additions and 2 deletions
+10 -2
View File
@@ -75,13 +75,21 @@ try {
$eventLogger->start('console:build_application', 'Build Application instance and load commands');
$application = \OCP\Server::get(Application::class);
$application->loadCommands(new ArgvInput(), new ConsoleOutput());
$argv = $_SERVER['argv'];
if (($key = array_search('--debug', $argv)) !== false) {
// Remove --debug option if it was passed
unset($argv[$key]);
$argv = array_values($argv);
}
$input = new ArgvInput($argv);
$application->loadCommands($input, new ConsoleOutput());
$eventLogger->end('console:build_application');
$eventLogger->start('console:run', 'Run the command');
$application->setAutoExit(false);
$exitCode = $application->run();
$exitCode = $application->run($input);
$eventLogger->end('console:run');