diff options
author | Samuel <faust64@gmail.com> | 2021-02-08 12:11:00 +0300 |
---|---|---|
committer | Samuel <faust64@gmail.com> | 2021-02-08 12:11:00 +0300 |
commit | 77825e69619dc524653d539a8ba0d8132130c9dc (patch) | |
tree | 062fa5023630d4eb1bb273e4ec57ae0dd4851d91 | |
parent | 2c59e59023a8831179e7e04f78849b5e8e676033 (diff) |
fix(logger): set logger in constructor
Signed-off-by: Samuel <faust64@gmail.com>
-rw-r--r-- | apps/federatedfilesharing/lib/Notifications.php | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/apps/federatedfilesharing/lib/Notifications.php b/apps/federatedfilesharing/lib/Notifications.php index 52aa83fad46..181a0994952 100644 --- a/apps/federatedfilesharing/lib/Notifications.php +++ b/apps/federatedfilesharing/lib/Notifications.php @@ -35,6 +35,7 @@ use OCP\Federation\ICloudFederationFactory; use OCP\Federation\ICloudFederationProviderManager; use OCP\Http\Client\IClientService; use OCP\OCS\IDiscoveryService; +use OCP\ILogger; class Notifications { public const RESPONSE_FORMAT = 'json'; // default response format for ocs calls @@ -60,6 +61,9 @@ class Notifications { /** @var IEventDispatcher */ private $eventDispatcher; + /** @var ILogger */ + protected $logger; + public function __construct( AddressHandler $addressHandler, IClientService $httpClientService, @@ -73,6 +77,7 @@ class Notifications { $this->httpClientService = $httpClientService; $this->discoveryService = $discoveryService; $this->jobList = $jobList; + $this->logger = OC::$server->getLogger(); $this->federationProviderManager = $federationProviderManager; $this->cloudFederationFactory = $cloudFederationFactory; $this->eventDispatcher = $eventDispatcher; @@ -124,13 +129,13 @@ class Notifications { $this->eventDispatcher->dispatchTyped($event); return true; } else { - \OC::$server->getLogger()->info( + $this->logger->info( "failed sharing $name with $shareWith", ['app' => 'federatedfilesharing'] ); } } else { - \OC::$server->getLogger()->info( + $this->logger->info( "could not share $name, invalid contact $shareWith", ['app' => 'federatedfilesharing'] ); @@ -185,17 +190,17 @@ class Notifications { $status['ocs']['data']['remoteId'] ]; } elseif (!$validToken) { - \OC::$server->getLogger()->info( + $this->logger->info( "invalid or missing token requesting re-share for $filename to $remote", ['app' => 'federatedfilesharing'] ); } elseif (!$validRemoteId) { - \OC::$server->getLogger()->info( + $this->logger->info( "missing remote id requesting re-share for $filename to $remote", ['app' => 'federatedfilesharing'] ); } else { - \OC::$server->getLogger()->info( + $this->logger->info( "failed requesting re-share for $filename to $remote", ['app' => 'federatedfilesharing'] ); |