diff options
author | Joas Schilling <coding@schilljs.com> | 2021-04-16 14:26:43 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-04-27 14:34:32 +0200 |
commit | 56ae87c281d2f54b23f98acf0e138d8e72196a06 (patch) | |
tree | d875702c4eb0901bcf6d3e23570a05ba5c397954 /lib/private/App | |
parent | bf1c875425e7fdf5ffd3c233ddf1f567428b4168 (diff) | |
download | nextcloud-server-56ae87c281d2f54b23f98acf0e138d8e72196a06.tar.gz nextcloud-server-56ae87c281d2f54b23f98acf0e138d8e72196a06.zip |
Less ILogger
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/App')
-rw-r--r-- | lib/private/App/AppManager.php | 18 | ||||
-rw-r--r-- | lib/private/App/AppStore/Fetcher/AppFetcher.php | 17 | ||||
-rw-r--r-- | lib/private/App/AppStore/Fetcher/CategoryFetcher.php | 11 | ||||
-rw-r--r-- | lib/private/App/AppStore/Fetcher/Fetcher.php | 18 |
4 files changed, 20 insertions, 44 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index 7063878429a..a00a93aa847 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -46,9 +46,9 @@ use OCP\ICacheFactory; use OCP\IConfig; use OCP\IGroup; use OCP\IGroupManager; -use OCP\ILogger; use OCP\IUser; use OCP\IUserSession; +use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; class AppManager implements IAppManager { @@ -83,7 +83,7 @@ class AppManager implements IAppManager { /** @var EventDispatcherInterface */ private $dispatcher; - /** @var ILogger */ + /** @var LoggerInterface */ private $logger; /** @var string[] $appId => $enabled */ @@ -104,21 +104,13 @@ class AppManager implements IAppManager { /** @var array */ private $autoDisabledApps = []; - /** - * @param IUserSession $userSession - * @param IConfig $config - * @param AppConfig $appConfig - * @param IGroupManager $groupManager - * @param ICacheFactory $memCacheFactory - * @param EventDispatcherInterface $dispatcher - */ public function __construct(IUserSession $userSession, IConfig $config, AppConfig $appConfig, IGroupManager $groupManager, ICacheFactory $memCacheFactory, EventDispatcherInterface $dispatcher, - ILogger $logger) { + LoggerInterface $logger) { $this->userSession = $userSession; $this->config = $config; $this->appConfig = $appConfig; @@ -249,7 +241,7 @@ class AppManager implements IAppManager { if (!is_array($groupIds)) { $jsonError = json_last_error(); - $this->logger->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError, ['app' => 'lib']); + $this->logger->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError); return false; } @@ -282,7 +274,7 @@ class AppManager implements IAppManager { if (!is_array($groupIds)) { $jsonError = json_last_error(); - $this->logger->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError, ['app' => 'lib']); + $this->logger->warning('AppManger::checkAppForUser - can\'t decode group IDs: ' . print_r($enabled, true) . ' - json error code: ' . $jsonError); return false; } diff --git a/lib/private/App/AppStore/Fetcher/AppFetcher.php b/lib/private/App/AppStore/Fetcher/AppFetcher.php index 416e55463cf..cd6b005c0d1 100644 --- a/lib/private/App/AppStore/Fetcher/AppFetcher.php +++ b/lib/private/App/AppStore/Fetcher/AppFetcher.php @@ -37,6 +37,7 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\Http\Client\IClientService; use OCP\IConfig; use OCP\ILogger; +use Psr\Log\LoggerInterface; class AppFetcher extends Fetcher { @@ -46,20 +47,12 @@ class AppFetcher extends Fetcher { /** @var bool */ private $ignoreMaxVersion; - /** - * @param Factory $appDataFactory - * @param IClientService $clientService - * @param ITimeFactory $timeFactory - * @param IConfig $config - * @param CompareVersion $compareVersion - * @param ILogger $logger - */ public function __construct(Factory $appDataFactory, IClientService $clientService, ITimeFactory $timeFactory, IConfig $config, CompareVersion $compareVersion, - ILogger $logger) { + LoggerInterface $logger) { parent::__construct( $appDataFactory, $clientService, @@ -86,7 +79,7 @@ class AppFetcher extends Fetcher { protected function fetch($ETag, $content, $allowUnstable = false) { /** @var mixed[] $response */ $response = parent::fetch($ETag, $content); - + if (empty($response)) { return []; } @@ -134,7 +127,9 @@ class AppFetcher extends Fetcher { $releases[] = $release; } } catch (\InvalidArgumentException $e) { - $this->logger->logException($e, ['app' => 'appstoreFetcher', 'level' => ILogger::WARN]); + $this->logger->warning($e->getMessage(), [ + 'exception' => $e, + ]); } } } diff --git a/lib/private/App/AppStore/Fetcher/CategoryFetcher.php b/lib/private/App/AppStore/Fetcher/CategoryFetcher.php index e34fbee8c58..896444a6640 100644 --- a/lib/private/App/AppStore/Fetcher/CategoryFetcher.php +++ b/lib/private/App/AppStore/Fetcher/CategoryFetcher.php @@ -31,21 +31,14 @@ use OC\Files\AppData\Factory; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Http\Client\IClientService; use OCP\IConfig; -use OCP\ILogger; +use Psr\Log\LoggerInterface; class CategoryFetcher extends Fetcher { - /** - * @param Factory $appDataFactory - * @param IClientService $clientService - * @param ITimeFactory $timeFactory - * @param IConfig $config - * @param ILogger $logger - */ public function __construct(Factory $appDataFactory, IClientService $clientService, ITimeFactory $timeFactory, IConfig $config, - ILogger $logger) { + LoggerInterface $logger) { parent::__construct( $appDataFactory, $clientService, diff --git a/lib/private/App/AppStore/Fetcher/Fetcher.php b/lib/private/App/AppStore/Fetcher/Fetcher.php index c5d83fcb1df..24c2fce00f5 100644 --- a/lib/private/App/AppStore/Fetcher/Fetcher.php +++ b/lib/private/App/AppStore/Fetcher/Fetcher.php @@ -39,7 +39,7 @@ use OCP\Files\IAppData; use OCP\Files\NotFoundException; use OCP\Http\Client\IClientService; use OCP\IConfig; -use OCP\ILogger; +use Psr\Log\LoggerInterface; abstract class Fetcher { public const INVALIDATE_AFTER_SECONDS = 3600; @@ -53,7 +53,7 @@ abstract class Fetcher { protected $timeFactory; /** @var IConfig */ protected $config; - /** @var Ilogger */ + /** @var LoggerInterface */ protected $logger; /** @var string */ protected $fileName; @@ -64,18 +64,11 @@ abstract class Fetcher { /** @var string */ protected $channel; - /** - * @param Factory $appDataFactory - * @param IClientService $clientService - * @param ITimeFactory $timeFactory - * @param IConfig $config - * @param ILogger $logger - */ public function __construct(Factory $appDataFactory, IClientService $clientService, ITimeFactory $timeFactory, IConfig $config, - ILogger $logger) { + LoggerInterface $logger) { $this->appData = $appDataFactory->get('appstore'); $this->clientService = $clientService; $this->timeFactory = $timeFactory; @@ -202,7 +195,10 @@ abstract class Fetcher { $this->logger->warning('Could not connect to appstore: ' . $e->getMessage(), ['app' => 'appstoreFetcher']); return []; } catch (\Exception $e) { - $this->logger->logException($e, ['app' => 'appstoreFetcher', 'level' => ILogger::WARN]); + $this->logger->warning($e->getMessage(), [ + 'exception' => $e, + 'app' => 'appstoreFetcher', + ]); return []; } } |