aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2021-03-01 20:53:41 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2021-03-02 10:47:25 +0100
commit38f761f25f1368cc45e41022b49f4cf2d7261197 (patch)
tree7f85d8682bf1de200dc22025977ca5705779ee0a /apps/settings/lib
parent148cc83c52aae2795a10c80ee9696522b49b4329 (diff)
downloadnextcloud-server-38f761f25f1368cc45e41022b49f4cf2d7261197.tar.gz
nextcloud-server-38f761f25f1368cc45e41022b49f4cf2d7261197.zip
Move away some ILoggers
Makes psalm happier Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/settings/lib')
-rw-r--r--apps/settings/lib/Controller/AppSettingsController.php12
-rw-r--r--apps/settings/lib/Controller/AuthSettingsController.php11
-rw-r--r--apps/settings/lib/Controller/CheckSetupController.php16
3 files changed, 22 insertions, 17 deletions
diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php
index 4d22e90f645..b9bbfddb249 100644
--- a/apps/settings/lib/Controller/AppSettingsController.php
+++ b/apps/settings/lib/Controller/AppSettingsController.php
@@ -48,11 +48,11 @@ use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\IL10N;
-use OCP\ILogger;
use OCP\INavigationManager;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\L10N\IFactory;
+use Psr\Log\LoggerInterface;
class AppSettingsController extends Controller {
@@ -76,7 +76,7 @@ class AppSettingsController extends Controller {
private $installer;
/** @var IURLGenerator */
private $urlGenerator;
- /** @var ILogger */
+ /** @var LoggerInterface */
private $logger;
/** @var array */
@@ -95,7 +95,7 @@ class AppSettingsController extends Controller {
* @param BundleFetcher $bundleFetcher
* @param Installer $installer
* @param IURLGenerator $urlGenerator
- * @param ILogger $logger
+ * @param LoggerInterface $logger
*/
public function __construct(string $appName,
IRequest $request,
@@ -109,7 +109,7 @@ class AppSettingsController extends Controller {
BundleFetcher $bundleFetcher,
Installer $installer,
IURLGenerator $urlGenerator,
- ILogger $logger) {
+ LoggerInterface $logger) {
parent::__construct($appName, $request);
$this->l10n = $l10n;
$this->config = $config;
@@ -458,7 +458,7 @@ class AppSettingsController extends Controller {
}
return new JSONResponse(['data' => ['update_required' => $updateRequired]]);
} catch (\Exception $e) {
- $this->logger->logException($e);
+ $this->logger->error('could not enable apps', ['exception' => $e]);
return new JSONResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_INTERNAL_SERVER_ERROR);
}
}
@@ -499,7 +499,7 @@ class AppSettingsController extends Controller {
}
return new JSONResponse([]);
} catch (\Exception $e) {
- $this->logger->logException($e);
+ $this->logger->error('could not disable app', ['exception' => $e]);
return new JSONResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_INTERNAL_SERVER_ERROR);
}
}
diff --git a/apps/settings/lib/Controller/AuthSettingsController.php b/apps/settings/lib/Controller/AuthSettingsController.php
index 13815f95c50..9535b3bec67 100644
--- a/apps/settings/lib/Controller/AuthSettingsController.php
+++ b/apps/settings/lib/Controller/AuthSettingsController.php
@@ -46,12 +46,12 @@ use OCP\Activity\IManager;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
-use OCP\ILogger;
use OCP\IRequest;
use OCP\ISession;
use OCP\IUserSession;
use OCP\Security\ISecureRandom;
use OCP\Session\Exceptions\SessionNotAvailableException;
+use Psr\Log\LoggerInterface;
class AuthSettingsController extends Controller {
@@ -76,7 +76,7 @@ class AuthSettingsController extends Controller {
/** @var RemoteWipe */
private $remoteWipe;
- /** @var ILogger */
+ /** @var LoggerInterface */
private $logger;
/**
@@ -89,7 +89,7 @@ class AuthSettingsController extends Controller {
* @param IUserSession $userSession
* @param IManager $activityManager
* @param RemoteWipe $remoteWipe
- * @param ILogger $logger
+ * @param LoggerInterface $logger
*/
public function __construct(string $appName,
IRequest $request,
@@ -100,7 +100,7 @@ class AuthSettingsController extends Controller {
IUserSession $userSession,
IManager $activityManager,
RemoteWipe $remoteWipe,
- ILogger $logger) {
+ LoggerInterface $logger) {
parent::__construct($appName, $request);
$this->tokenProvider = $tokenProvider;
$this->uid = $userId;
@@ -252,8 +252,7 @@ class AuthSettingsController extends Controller {
try {
$this->activityManager->publish($event);
} catch (BadMethodCallException $e) {
- $this->logger->warning('could not publish activity');
- $this->logger->logException($e);
+ $this->logger->warning('could not publish activity', ['exception' => $e]);
}
}
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php
index d732b137199..bb7bd1f8843 100644
--- a/apps/settings/lib/Controller/CheckSetupController.php
+++ b/apps/settings/lib/Controller/CheckSetupController.php
@@ -73,11 +73,11 @@ use OCP\IConfig;
use OCP\IDateTimeFormatter;
use OCP\IDBConnection;
use OCP\IL10N;
-use OCP\ILogger;
use OCP\IRequest;
use OCP\IURLGenerator;
use OCP\Lock\ILockingProvider;
use OCP\Security\ISecureRandom;
+use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
@@ -92,7 +92,7 @@ class CheckSetupController extends Controller {
private $l10n;
/** @var Checker */
private $checker;
- /** @var ILogger */
+ /** @var LoggerInterface */
private $logger;
/** @var EventDispatcherInterface */
private $dispatcher;
@@ -118,7 +118,7 @@ class CheckSetupController extends Controller {
IURLGenerator $urlGenerator,
IL10N $l10n,
Checker $checker,
- ILogger $logger,
+ LoggerInterface $logger,
EventDispatcherInterface $dispatcher,
Connection $db,
ILockingProvider $lockingProvider,
@@ -178,7 +178,10 @@ class CheckSetupController extends Controller {
$client->get($httpSiteName);
$client->get($httpsSiteName);
} catch (\Exception $e) {
- $this->logger->logException($e, ['app' => 'internet_connection_check']);
+ $this->logger->error('Cannot connect to: ' . $sitename, [
+ 'app' => 'internet_connection_check',
+ 'exception' => $e,
+ ]);
return false;
}
return true;
@@ -273,7 +276,10 @@ class CheckSetupController extends Controller {
return $this->l10n->t('cURL is using an outdated %1$s version (%2$s). Please update your operating system or features such as %3$s will not work reliably.', ['NSS', $versionString, $features]);
}
} catch (\Exception $e) {
- $this->logger->logException($e, ['app' => 'settings', 'level' => \OCP\ILogger::WARN]);
+ $this->logger->warning('error checking curl', [
+ 'app' => 'settings',
+ 'exception' => $e,
+ ]);
return $this->l10n->t('Could not determine if TLS version of cURL is outdated or not because an error happened during the HTTPS request against https://nextcloud.com. Please check the nextcloud log file for more details.');
}
}