diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-10-16 23:39:28 +0200 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-10-16 23:39:28 +0200 |
commit | 1d90f84141c60ed07ae43d4e1098d14582ea1ea9 (patch) | |
tree | 1eff39d63b99f32f284a038ea92a1306e14c7982 /apps/files_external/lib/Lib | |
parent | ff4c8e9beea6c66b016f2fa59569d4e7cdeb921d (diff) | |
download | nextcloud-server-1d90f84141c60ed07ae43d4e1098d14582ea1ea9.tar.gz nextcloud-server-1d90f84141c60ed07ae43d4e1098d14582ea1ea9.zip |
Port to LoggerInterface
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps/files_external/lib/Lib')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/AmazonS3.php | 54 |
1 files changed, 44 insertions, 10 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index d5b8eff6fe5..f5bb7eb5f06 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -55,11 +55,14 @@ use OCP\ICacheFactory; use OCP\IMemcache; use OCP\Server; use OCP\ICache; +use Psr\Log\LoggerInterface; class AmazonS3 extends \OC\Files\Storage\Common { use S3ConnectionTrait; use S3ObjectTrait; + private LoggerInterface $logger; + public function needsPartFile() { return false; } @@ -88,6 +91,7 @@ class AmazonS3 extends \OC\Files\Storage\Common { /** @var ICacheFactory $cacheFactory */ $cacheFactory = Server::get(ICacheFactory::class); $this->memCache = $cacheFactory->createLocal('s3-external'); + $this->logger = \OCP\Server::get(LoggerInterface::class); } /** @@ -255,7 +259,10 @@ class AmazonS3 extends \OC\Files\Storage\Common { ]); $this->testTimeout(); } catch (S3Exception $e) { - \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); + $this->logger->error($e->getMessage(), [ + 'app' => 'files_external', + 'exception' => $e, + ]); return false; } @@ -327,7 +334,10 @@ class AmazonS3 extends \OC\Files\Storage\Common { $this->deleteObject($path); } } catch (S3Exception $e) { - \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); + $this->logger->error($e->getMessage(), [ + 'app' => 'files_external', + 'exception' => $e, + ]); return false; } return true; @@ -415,7 +425,10 @@ class AmazonS3 extends \OC\Files\Storage\Common { try { return $this->doesDirectoryExist($path); } catch (S3Exception $e) { - \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); + $this->logger->error($e->getMessage(), [ + 'app' => 'files_external', + 'exception' => $e, + ]); return false; } } @@ -438,7 +451,10 @@ class AmazonS3 extends \OC\Files\Storage\Common { return 'dir'; } } catch (S3Exception $e) { - \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); + $this->logger->error($e->getMessage(), [ + 'app' => 'files_external', + 'exception' => $e, + ]); return false; } @@ -464,7 +480,10 @@ class AmazonS3 extends \OC\Files\Storage\Common { $this->deleteObject($path); $this->invalidateCache($path); } catch (S3Exception $e) { - \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); + $this->logger->error($e->getMessage(), [ + 'app' => 'files_external', + 'exception' => $e, + ]); return false; } @@ -486,7 +505,10 @@ class AmazonS3 extends \OC\Files\Storage\Common { try { return $this->readObject($path); } catch (S3Exception $e) { - \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); + $this->logger->error($e->getMessage(), [ + 'app' => 'files_external', + 'exception' => $e, + ]); return false; } case 'w': @@ -548,7 +570,10 @@ class AmazonS3 extends \OC\Files\Storage\Common { $this->testTimeout(); } } catch (S3Exception $e) { - \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); + $this->logger->error($e->getMessage(), [ + 'app' => 'files_external', + 'exception' => $e, + ]); return false; } @@ -569,7 +594,10 @@ class AmazonS3 extends \OC\Files\Storage\Common { ]); $this->testTimeout(); } catch (S3Exception $e) { - \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); + $this->logger->error($e->getMessage(), [ + 'app' => 'files_external', + 'exception' => $e, + ]); return false; } } else { @@ -579,7 +607,10 @@ class AmazonS3 extends \OC\Files\Storage\Common { $this->mkdir($path2); $this->testTimeout(); } catch (S3Exception $e) { - \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); + $this->logger->error($e->getMessage(), [ + 'app' => 'files_external', + 'exception' => $e, + ]); return false; } @@ -642,7 +673,10 @@ class AmazonS3 extends \OC\Files\Storage\Common { unlink($tmpFile); return true; } catch (S3Exception $e) { - \OC::$server->getLogger()->logException($e, ['app' => 'files_external']); + $this->logger->error($e->getMessage(), [ + 'app' => 'files_external', + 'exception' => $e, + ]); return false; } } |