diff options
author | Patrik Kernstock <info@pkern.at> | 2018-10-05 21:09:13 +0200 |
---|---|---|
committer | Patrik Kernstock <info@pkern.at> | 2018-10-05 21:09:13 +0200 |
commit | 1973556346c4c0550aec1b7b38727ea89416bbeb (patch) | |
tree | 53373924f951770c18622f1945bf4a19d841ac11 /core | |
parent | f27ce6b5a0efaf2f7a5f4942cccd6186f439ed42 (diff) | |
download | nextcloud-server-1973556346c4c0550aec1b7b38727ea89416bbeb.tar.gz nextcloud-server-1973556346c4c0550aec1b7b38727ea89416bbeb.zip |
Log exception using ILogger
Signed-off-by: Patrik Kernstock <info@pkern.at>
Diffstat (limited to 'core')
-rw-r--r-- | core/Command/App/Remove.php | 15 | ||||
-rw-r--r-- | core/register_command.php | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/core/Command/App/Remove.php b/core/Command/App/Remove.php index d14a3c6e090..dc8ea7c2203 100644 --- a/core/Command/App/Remove.php +++ b/core/Command/App/Remove.php @@ -24,6 +24,7 @@ namespace OC\Core\Command\App; use OC\Installer; use OCP\App\IAppManager; +use OCP\ILogger; use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface; use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; use Symfony\Component\Console\Command\Command; @@ -38,15 +39,19 @@ class Remove extends Command implements CompletionAwareInterface { protected $manager; /** @var Installer */ private $installer; + /** @var ILogger */ + private $logger; /** * @param IAppManager $manager * @param Installer $installer + * @param ILogger $logger */ - public function __construct(IAppManager $manager, Installer $installer) { + public function __construct(IAppManager $manager, Installer $installer, ILogger $logger) { parent::__construct(); $this->manager = $manager; $this->installer = $installer; + $this->logger = $logger; } protected function configure() { @@ -90,6 +95,10 @@ class Remove extends Command implements CompletionAwareInterface { $output->writeln($appId . ' disabled'); } catch(\Exception $e) { $output->writeln('Error: ' . $e->getMessage()); + $this->logger->logException($e, [ + 'app' => 'CLI', + 'level' => ILogger::ERROR + ]); return 1; } } @@ -99,6 +108,10 @@ class Remove extends Command implements CompletionAwareInterface { $result = $this->installer->removeApp($appId); } catch(\Exception $e) { $output->writeln('Error: ' . $e->getMessage()); + $this->logger->logException($e, [ + 'app' => 'CLI', + 'level' => ILogger::ERROR + ]); return 1; } diff --git a/core/register_command.php b/core/register_command.php index 02cc450c24f..9c3591c8afe 100644 --- a/core/register_command.php +++ b/core/register_command.php @@ -65,7 +65,7 @@ if (\OC::$server->getConfig()->getSystemValue('installed', false)) { $application->add(new OC\Core\Command\App\Install()); $application->add(new OC\Core\Command\App\GetPath()); $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager())); - $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class))); + $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->getLogger())); $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class)); $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enforce::class)); |