Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-03-30 11:55:41 +0300
committerCôme Chilliet <come.chilliet@nextcloud.com>2022-04-26 17:52:52 +0300
commit069477e608566c6ea9edbe259b46c591a82bd8af (patch)
treedf1d338e1d61d1c1b2151e1843dfaff7585818d1 /lib/private/Files/View.php
parent0654b245280a904068079b71c5339561537fdf78 (diff)
Migrate more classes of lib/private to LoggerInterface
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/Files/View.php')
-rw-r--r--lib/private/Files/View.php30
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php
index c209c8594f7..2b6732e2ba0 100644
--- a/lib/private/Files/View.php
+++ b/lib/private/Files/View.php
@@ -64,10 +64,10 @@ use OCP\Files\Mount\IMountPoint;
use OCP\Files\NotFoundException;
use OCP\Files\ReservedWordException;
use OCP\Files\Storage\IStorage;
-use OCP\ILogger;
use OCP\IUser;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
+use Psr\Log\LoggerInterface;
/**
* Class to provide access to ownCloud filesystem via a "view", and methods for
@@ -101,8 +101,7 @@ class View {
/** @var \OC\User\Manager */
private $userManager;
- /** @var \OCP\ILogger */
- private $logger;
+ private LoggerInterface $logger;
private DisplayNameCache $displayNameCache;
@@ -123,7 +122,7 @@ class View {
$this->lockingEnabled = !($this->lockingProvider instanceof \OC\Lock\NoopLockingProvider);
$this->userManager = \OC::$server->getUserManager();
$this->displayNameCache = \OC::$server->get(DisplayNameCache::class);
- $this->logger = \OC::$server->getLogger();
+ $this->logger = \OC::$server->get(LoggerInterface::class);
}
public function getAbsolutePath($path = '/') {
@@ -579,7 +578,7 @@ class View {
try {
$result = $this->basicOperation('touch', $path, $hooks, $mtime);
} catch (\Exception $e) {
- $this->logger->logException($e, ['level' => ILogger::INFO, 'message' => 'Error while setting modified time']);
+ $this->logger->info('Error while setting modified time', ['app' => 'core', 'exception' => $e]);
$result = false;
}
if (!$result) {
@@ -1000,11 +999,11 @@ class View {
$hooks[] = 'write';
break;
default:
- \OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, ILogger::ERROR);
+ $this->logger->error('invalid mode (' . $mode . ') for ' . $path, ['app' => 'core']);
}
if ($mode !== 'r' && $mode !== 'w') {
- \OC::$server->getLogger()->info('Trying to open a file with a mode other than "r" or "w" can cause severe performance issues with some backends');
+ $this->logger->info('Trying to open a file with a mode other than "r" or "w" can cause severe performance issues with some backends', ['app' => 'core']);
}
return $this->basicOperation('fopen', $path, $hooks, $mode);
@@ -1418,7 +1417,7 @@ class View {
return $info;
} else {
- \OC::$server->getLogger()->warning('Storage not valid for mountpoint: ' . $mount->getMountPoint());
+ $this->logger->warning('Storage not valid for mountpoint: ' . $mount->getMountPoint(), ['app' => 'core']);
}
return false;
@@ -1502,10 +1501,9 @@ class View {
continue;
} catch (\Exception $e) {
// sometimes when the storage is not available it can be any exception
- \OC::$server->getLogger()->logException($e, [
- 'message' => 'Exception while scanning storage "' . $subStorage->getId() . '"',
- 'level' => ILogger::ERROR,
- 'app' => 'lib',
+ $this->logger->error('Exception while scanning storage "' . $subStorage->getId() . '"', [
+ 'exception' => $e,
+ 'app' => 'core',
]);
continue;
}
@@ -1816,9 +1814,9 @@ class View {
);
if (count($shares) > 0) {
- \OCP\Util::writeLog('files',
+ $this->logger->debug(
'It is not allowed to move one mount point into a shared folder',
- ILogger::DEBUG);
+ ['app' => 'files']);
return false;
}
@@ -2146,9 +2144,9 @@ class View {
// "$user", "files", "path/to/dir"
if (!isset($parts[1]) || $parts[1] !== 'files') {
$this->logger->error(
- '$absolutePath must be relative to "files", value is "%s"',
+ '$absolutePath must be relative to "files", value is "{absolutePath}"',
[
- $absolutePath
+ 'absolutePath' => $absolutePath,
]
);
throw new \InvalidArgumentException('$absolutePath must be relative to "files"');