fix(logger): set logger in constructor

Signed-off-by: Samuel <faust64@gmail.com>
This commit is contained in:
Samuel 2021-02-08 10:11:00 +01:00
parent 2c59e59023
commit 77825e6961
1 changed files with 10 additions and 5 deletions

View File

@ -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']
);