diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-03-31 15:34:57 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-05-02 10:52:43 +0200 |
commit | e2531f8503dea904dd1cb389ca017ce7bda5ccfc (patch) | |
tree | 683918ba234959dd76e771aaae2af434b21d09fe /apps/dav/lib/Comments | |
parent | 49b650c4a46c76121d74c6c37c0dbfa0d8f53dbe (diff) | |
download | nextcloud-server-e2531f8503dea904dd1cb389ca017ce7bda5ccfc.tar.gz nextcloud-server-e2531f8503dea904dd1cb389ca017ce7bda5ccfc.zip |
Migrate dav application from ILogger to LoggerInterface
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/dav/lib/Comments')
-rw-r--r-- | apps/dav/lib/Comments/CommentNode.php | 17 | ||||
-rw-r--r-- | apps/dav/lib/Comments/EntityCollection.php | 9 | ||||
-rw-r--r-- | apps/dav/lib/Comments/EntityTypeCollection.php | 9 | ||||
-rw-r--r-- | apps/dav/lib/Comments/RootCollection.php | 14 |
4 files changed, 16 insertions, 33 deletions
diff --git a/apps/dav/lib/Comments/CommentNode.php b/apps/dav/lib/Comments/CommentNode.php index af76027671e..b41dbc276e8 100644 --- a/apps/dav/lib/Comments/CommentNode.php +++ b/apps/dav/lib/Comments/CommentNode.php @@ -26,9 +26,9 @@ namespace OCA\DAV\Comments; use OCP\Comments\IComment; use OCP\Comments\ICommentsManager; use OCP\Comments\MessageTooLongException; -use OCP\ILogger; use OCP\IUserManager; use OCP\IUserSession; +use Psr\Log\LoggerInterface; use Sabre\DAV\Exception\BadRequest; use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\Exception\MethodNotAllowed; @@ -52,8 +52,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { /** @var ICommentsManager */ protected $commentsManager; - /** @var ILogger */ - protected $logger; + protected LoggerInterface $logger; /** @var array list of properties with key being their name and value their setter */ protected $properties = []; @@ -66,19 +65,13 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { /** * CommentNode constructor. - * - * @param ICommentsManager $commentsManager - * @param IComment $comment - * @param IUserManager $userManager - * @param IUserSession $userSession - * @param ILogger $logger */ public function __construct( ICommentsManager $commentsManager, IComment $comment, IUserManager $userManager, IUserSession $userSession, - ILogger $logger + LoggerInterface $logger ) { $this->commentsManager = $commentsManager; $this->comment = $comment; @@ -194,7 +187,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { $this->commentsManager->save($this->comment); return true; } catch (\Exception $e) { - $this->logger->logException($e, ['app' => 'dav/comments']); + $this->logger->error($e->getMessage(), ['app' => 'dav/comments', 'exception' => $e]); if ($e instanceof MessageTooLongException) { $msg = 'Message exceeds allowed character limit of '; throw new BadRequest($msg . IComment::MAX_MESSAGE_LENGTH, 0, $e); @@ -287,7 +280,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties { try { $displayName = $this->commentsManager->resolveDisplayName($mention['type'], $mention['id']); } catch (\OutOfBoundsException $e) { - $this->logger->logException($e); + $this->logger->error($e->getMessage(), ['exception' => $e]); // No displayname, upon client's discretion what to display. $displayName = ''; } diff --git a/apps/dav/lib/Comments/EntityCollection.php b/apps/dav/lib/Comments/EntityCollection.php index d9b06e1240c..164c690afd0 100644 --- a/apps/dav/lib/Comments/EntityCollection.php +++ b/apps/dav/lib/Comments/EntityCollection.php @@ -25,9 +25,9 @@ namespace OCA\DAV\Comments; use OCP\Comments\ICommentsManager; use OCP\Comments\NotFoundException; -use OCP\ILogger; use OCP\IUserManager; use OCP\IUserSession; +use Psr\Log\LoggerInterface; use Sabre\DAV\Exception\NotFound; use Sabre\DAV\IProperties; use Sabre\DAV\PropPatch; @@ -46,8 +46,7 @@ class EntityCollection extends RootCollection implements IProperties { /** @var string */ protected $id; - /** @var ILogger */ - protected $logger; + protected LoggerInterface $logger; /** * @param string $id @@ -55,7 +54,7 @@ class EntityCollection extends RootCollection implements IProperties { * @param ICommentsManager $commentsManager * @param IUserManager $userManager * @param IUserSession $userSession - * @param ILogger $logger + * @param LoggerInterface $logger */ public function __construct( $id, @@ -63,7 +62,7 @@ class EntityCollection extends RootCollection implements IProperties { ICommentsManager $commentsManager, IUserManager $userManager, IUserSession $userSession, - ILogger $logger + LoggerInterface $logger ) { foreach (['id', 'name'] as $property) { $$property = trim($$property); diff --git a/apps/dav/lib/Comments/EntityTypeCollection.php b/apps/dav/lib/Comments/EntityTypeCollection.php index c9df2a068d7..d140a33ec4c 100644 --- a/apps/dav/lib/Comments/EntityTypeCollection.php +++ b/apps/dav/lib/Comments/EntityTypeCollection.php @@ -24,9 +24,9 @@ namespace OCA\DAV\Comments; use OCP\Comments\ICommentsManager; -use OCP\ILogger; use OCP\IUserManager; use OCP\IUserSession; +use Psr\Log\LoggerInterface; use Sabre\DAV\Exception\MethodNotAllowed; use Sabre\DAV\Exception\NotFound; @@ -43,8 +43,7 @@ use Sabre\DAV\Exception\NotFound; */ class EntityTypeCollection extends RootCollection { - /** @var ILogger */ - protected $logger; + protected LoggerInterface $logger; /** @var IUserManager */ protected $userManager; @@ -57,7 +56,7 @@ class EntityTypeCollection extends RootCollection { * @param ICommentsManager $commentsManager * @param IUserManager $userManager * @param IUserSession $userSession - * @param ILogger $logger + * @param LoggerInterface $logger * @param \Closure $childExistsFunction */ public function __construct( @@ -65,7 +64,7 @@ class EntityTypeCollection extends RootCollection { ICommentsManager $commentsManager, IUserManager $userManager, IUserSession $userSession, - ILogger $logger, + LoggerInterface $logger, \Closure $childExistsFunction ) { $name = trim($name); diff --git a/apps/dav/lib/Comments/RootCollection.php b/apps/dav/lib/Comments/RootCollection.php index e8e890696eb..9832030291e 100644 --- a/apps/dav/lib/Comments/RootCollection.php +++ b/apps/dav/lib/Comments/RootCollection.php @@ -26,9 +26,9 @@ namespace OCA\DAV\Comments; use OCP\Comments\CommentsEntityEvent; use OCP\Comments\ICommentsManager; -use OCP\ILogger; use OCP\IUserManager; use OCP\IUserSession; +use Psr\Log\LoggerInterface; use Sabre\DAV\Exception\Forbidden; use Sabre\DAV\Exception\NotAuthenticated; use Sabre\DAV\Exception\NotFound; @@ -46,8 +46,7 @@ class RootCollection implements ICollection { /** @var string */ protected $name = 'comments'; - /** @var ILogger */ - protected $logger; + protected LoggerInterface $logger; /** @var IUserManager */ protected $userManager; @@ -58,19 +57,12 @@ class RootCollection implements ICollection { /** @var EventDispatcherInterface */ protected $dispatcher; - /** - * @param ICommentsManager $commentsManager - * @param IUserManager $userManager - * @param IUserSession $userSession - * @param EventDispatcherInterface $dispatcher - * @param ILogger $logger - */ public function __construct( ICommentsManager $commentsManager, IUserManager $userManager, IUserSession $userSession, EventDispatcherInterface $dispatcher, - ILogger $logger) { + LoggerInterface $logger) { $this->commentsManager = $commentsManager; $this->logger = $logger; $this->userManager = $userManager; |