diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2024-02-08 15:47:39 +0100 |
---|---|---|
committer | Côme Chilliet <91878298+come-nc@users.noreply.github.com> | 2024-02-13 17:32:30 +0100 |
commit | c0ce272e9c3a94ff98081c4f90a31ca611d28323 (patch) | |
tree | e92ba163d28ac3eb888a95718a85a78909cdc7c7 /lib/private/Log | |
parent | 8822b16d37de1d1a3cec959d184261152c42ae41 (diff) | |
download | nextcloud-server-c0ce272e9c3a94ff98081c4f90a31ca611d28323.tar.gz nextcloud-server-c0ce272e9c3a94ff98081c4f90a31ca611d28323.zip |
chore: Migrate away from OC::$server->getLogger
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private/Log')
-rw-r--r-- | lib/private/Log/Rotate.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/private/Log/Rotate.php b/lib/private/Log/Rotate.php index efe548b7783..71965a12035 100644 --- a/lib/private/Log/Rotate.php +++ b/lib/private/Log/Rotate.php @@ -24,7 +24,9 @@ */ namespace OC\Log; +use OCP\IConfig; use OCP\Log\RotationTrait; +use Psr\Log\LoggerInterface; /** * This rotates the current logfile to a new name, this way the total log usage @@ -35,15 +37,15 @@ use OCP\Log\RotationTrait; class Rotate extends \OCP\BackgroundJob\Job { use RotationTrait; - public function run($dummy): void { - $systemConfig = \OC::$server->getSystemConfig(); - $this->filePath = $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log'); + public function run($argument): void { + $config = \OCP\Server::get(IConfig::class); + $this->filePath = $config->getSystemValueString('logfile', $config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data') . '/nextcloud.log'); - $this->maxSize = \OC::$server->getConfig()->getSystemValueInt('log_rotate_size', 100 * 1024 * 1024); + $this->maxSize = $config->getSystemValueInt('log_rotate_size', 100 * 1024 * 1024); if ($this->shouldRotateBySize()) { $rotatedFile = $this->rotate(); $msg = 'Log file "'.$this->filePath.'" was over '.$this->maxSize.' bytes, moved to "'.$rotatedFile.'"'; - \OC::$server->getLogger()->info($msg, ['app' => Rotate::class]); + \OCP\Server::get(LoggerInterface::class)->info($msg, ['app' => Rotate::class]); } } } |