diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-09-19 16:06:40 +0200 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2023-09-21 11:57:21 +0200 |
commit | 0a9371f99f05786068d6f6a72b9a717ec24690a8 (patch) | |
tree | 90ae93c3e608e2bf90a1ed0a54defb053d3e86ef /apps/twofactor_backupcodes | |
parent | b6761fbc967bd165279ca20af8c05cae045267d4 (diff) | |
download | nextcloud-server-0a9371f99f05786068d6f6a72b9a717ec24690a8.tar.gz nextcloud-server-0a9371f99f05786068d6f6a72b9a717ec24690a8.zip |
Migrate applications away from deprecated ILogger
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/twofactor_backupcodes')
-rw-r--r-- | apps/twofactor_backupcodes/lib/Listener/ActivityPublisher.php | 20 | ||||
-rw-r--r-- | apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php | 8 |
2 files changed, 9 insertions, 19 deletions
diff --git a/apps/twofactor_backupcodes/lib/Listener/ActivityPublisher.php b/apps/twofactor_backupcodes/lib/Listener/ActivityPublisher.php index 764787b5400..dd1fd391b68 100644 --- a/apps/twofactor_backupcodes/lib/Listener/ActivityPublisher.php +++ b/apps/twofactor_backupcodes/lib/Listener/ActivityPublisher.php @@ -30,20 +30,13 @@ use OCA\TwoFactorBackupCodes\Event\CodesGenerated; use OCP\Activity\IManager; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; -use OCP\ILogger; +use Psr\Log\LoggerInterface; class ActivityPublisher implements IEventListener { - - /** @var IManager */ - private $activityManager; - - /** @var ILogger */ - private $logger; - - public function __construct(IManager $activityManager, - ILogger $logger) { - $this->activityManager = $activityManager; - $this->logger = $logger; + public function __construct( + private IManager $activityManager, + private LoggerInterface $logger, + ) { } /** @@ -60,8 +53,7 @@ class ActivityPublisher implements IEventListener { try { $this->activityManager->publish($activity); } catch (BadMethodCallException $e) { - $this->logger->warning('could not publish backup code creation activity', ['app' => 'twofactor_backupcodes']); - $this->logger->logException($e, ['app' => 'twofactor_backupcodes']); + $this->logger->error('Could not publish backup code creation activity', ['exception' => $e]); } } } diff --git a/apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php b/apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php index a001a9694de..68fb89907f8 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php +++ b/apps/twofactor_backupcodes/tests/Unit/Listener/ActivityPublisherTest.php @@ -32,18 +32,16 @@ use OCA\TwoFactorBackupCodes\Listener\ActivityPublisher; use OCP\Activity\IEvent; use OCP\Activity\IManager; use OCP\EventDispatcher\Event; -use OCP\ILogger; use OCP\IUser; use PHPUnit\Framework\MockObject\MockObject; +use Psr\Log\LoggerInterface; use Test\TestCase; class ActivityPublisherTest extends TestCase { - /** @var IManager|MockObject */ private $activityManager; - /** @var ILogger */ - + /** @var LoggerInterface */ private $logger; /** @var ActivityPublisher */ @@ -53,7 +51,7 @@ class ActivityPublisherTest extends TestCase { parent::setUp(); $this->activityManager = $this->createMock(IManager::class); - $this->logger = $this->createMock(ILogger::class); + $this->logger = $this->createMock(LoggerInterface::class); $this->listener = new ActivityPublisher($this->activityManager, $this->logger); } |