Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-10-07 11:58:54 +0300
committerGitHub <noreply@github.com>2020-10-07 11:58:54 +0300
commit106257733e1cce01550b718989dbc137b899f6da (patch)
tree41aee7490aceeeec10ffce8e453c04399c20d088 /lib
parent678ef8466d5d1788bab1cf66786e47515a1bcbd9 (diff)
parent17454f6ce901ca3ee8159c7b95ff79a9285fe910 (diff)
Merge pull request #23244 from nextcloud/techdebt/noid/user-psr-logger-interface-in-comments
Use PSR logger interface in comments manager
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Comments/Manager.php28
-rw-r--r--lib/private/Comments/ManagerFactory.php3
2 files changed, 17 insertions, 14 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php
index 1acfe79824c..39d1f2c847f 100644
--- a/lib/private/Comments/Manager.php
+++ b/lib/private/Comments/Manager.php
@@ -38,15 +38,15 @@ use OCP\Comments\NotFoundException;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IConfig;
use OCP\IDBConnection;
-use OCP\ILogger;
use OCP\IUser;
+use Psr\Log\LoggerInterface;
class Manager implements ICommentsManager {
/** @var IDBConnection */
protected $dbConn;
- /** @var ILogger */
+ /** @var LoggerInterface */
protected $logger;
/** @var IConfig */
@@ -64,16 +64,9 @@ class Manager implements ICommentsManager {
/** @var \Closure[] */
protected $displayNameResolvers = [];
- /**
- * Manager constructor.
- *
- * @param IDBConnection $dbConn
- * @param ILogger $logger
- * @param IConfig $config
- */
public function __construct(
IDBConnection $dbConn,
- ILogger $logger,
+ LoggerInterface $logger,
IConfig $config
) {
$this->dbConn = $dbConn;
@@ -693,7 +686,10 @@ class Manager implements ICommentsManager {
$affectedRows = $query->execute();
$this->uncache($id);
} catch (DriverException $e) {
- $this->logger->logException($e, ['app' => 'core_comments']);
+ $this->logger->error($e->getMessage(), [
+ 'exception' => $e,
+ 'app' => 'core_comments',
+ ]);
return false;
}
@@ -918,7 +914,10 @@ class Manager implements ICommentsManager {
try {
$affectedRows = $query->execute();
} catch (DriverException $e) {
- $this->logger->logException($e, ['app' => 'core_comments']);
+ $this->logger->error($e->getMessage(), [
+ 'exception' => $e,
+ 'app' => 'core_comments',
+ ]);
return false;
}
return ($affectedRows > 0);
@@ -1022,7 +1021,10 @@ class Manager implements ICommentsManager {
try {
$affectedRows = $query->execute();
} catch (DriverException $e) {
- $this->logger->logException($e, ['app' => 'core_comments']);
+ $this->logger->error($e->getMessage(), [
+ 'exception' => $e,
+ 'app' => 'core_comments',
+ ]);
return false;
}
return ($affectedRows > 0);
diff --git a/lib/private/Comments/ManagerFactory.php b/lib/private/Comments/ManagerFactory.php
index dd69a4f9261..4888b133143 100644
--- a/lib/private/Comments/ManagerFactory.php
+++ b/lib/private/Comments/ManagerFactory.php
@@ -28,6 +28,7 @@ namespace OC\Comments;
use OCP\Comments\ICommentsManager;
use OCP\Comments\ICommentsManagerFactory;
use OCP\IServerContainer;
+use Psr\Log\LoggerInterface;
class ManagerFactory implements ICommentsManagerFactory {
@@ -56,7 +57,7 @@ class ManagerFactory implements ICommentsManagerFactory {
public function getManager() {
return new Manager(
$this->serverContainer->getDatabaseConnection(),
- $this->serverContainer->getLogger(),
+ $this->serverContainer->get(LoggerInterface::class),
$this->serverContainer->getConfig()
);
}