diff options
author | Joas Schilling <coding@schilljs.com> | 2020-10-08 17:48:03 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-10-08 17:52:56 +0300 |
commit | 51fbcb08010ee1f5790151a0f8a2aacd523fec30 (patch) | |
tree | 43291595155543a42c4f65a07fb87db85e8336f4 /lib | |
parent | e10cad4a718422b8b9d19546cc61cb39e4c0ee26 (diff) |
Use PSR Logger in event dispatcher
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/EventDispatcher/EventDispatcher.php | 6 | ||||
-rw-r--r-- | lib/private/EventDispatcher/ServiceEventListener.php | 11 |
2 files changed, 8 insertions, 9 deletions
diff --git a/lib/private/EventDispatcher/EventDispatcher.php b/lib/private/EventDispatcher/EventDispatcher.php index f2a87cc4c70..8fe4bcbb942 100644 --- a/lib/private/EventDispatcher/EventDispatcher.php +++ b/lib/private/EventDispatcher/EventDispatcher.php @@ -28,6 +28,7 @@ declare(strict_types=1); namespace OC\EventDispatcher; +use Psr\Log\LoggerInterface; use function get_class; use OC\Broadcast\Events\BroadcastEvent; use OCP\Broadcast\Events\IBroadcastEvent; @@ -35,7 +36,6 @@ use OCP\EventDispatcher\ABroadcastedEvent; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventDispatcher; use OCP\IContainer; -use OCP\ILogger; use OCP\IServerContainer; use Symfony\Component\EventDispatcher\EventDispatcher as SymfonyDispatcher; @@ -47,12 +47,12 @@ class EventDispatcher implements IEventDispatcher { /** @var IContainer */ private $container; - /** @var ILogger */ + /** @var LoggerInterface */ private $logger; public function __construct(SymfonyDispatcher $dispatcher, IServerContainer $container, - ILogger $logger) { + LoggerInterface $logger) { $this->dispatcher = $dispatcher; $this->container = $container; $this->logger = $logger; diff --git a/lib/private/EventDispatcher/ServiceEventListener.php b/lib/private/EventDispatcher/ServiceEventListener.php index a648884d6f7..ec26514c0a6 100644 --- a/lib/private/EventDispatcher/ServiceEventListener.php +++ b/lib/private/EventDispatcher/ServiceEventListener.php @@ -30,7 +30,7 @@ use OCP\AppFramework\QueryException; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\IContainer; -use OCP\ILogger; +use Psr\Log\LoggerInterface; /** * Lazy service event listener @@ -46,7 +46,7 @@ final class ServiceEventListener { /** @var string */ private $class; - /** @var ILogger */ + /** @var LoggerInterface */ private $logger; /** @var null|IEventListener */ @@ -54,7 +54,7 @@ final class ServiceEventListener { public function __construct(IContainer $container, string $class, - ILogger $logger) { + LoggerInterface $logger) { $this->container = $container; $this->class = $class; $this->logger = $logger; @@ -65,9 +65,8 @@ final class ServiceEventListener { try { $this->service = $this->container->query($this->class); } catch (QueryException $e) { - $this->logger->logException($e, [ - 'level' => ILogger::ERROR, - 'message' => "Could not load event listener service " . $this->class, + $this->logger->error("Could not load event listener service " . $this->class, [ + 'exception' => $e, ]); return; } |