diff options
Diffstat (limited to 'apps/dav/lib/Comments/CommentNode.php')
-rw-r--r-- | apps/dav/lib/Comments/CommentNode.php | 17 |
1 files changed, 5 insertions, 12 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 = ''; } |