diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-12-01 11:21:57 +0100 |
---|---|---|
committer | Côme Chilliet (Rebase PR Action) <come-nc@users.noreply.github.com> | 2022-12-19 09:10:40 +0000 |
commit | e1d324f7ebb311b1e0ed094ec13de43163d7cc68 (patch) | |
tree | 2de43d148905b94769d34eb45d703ca8efa82875 /lib/base.php | |
parent | 26d75add8f48933538ec39419752bc94bfc078ec (diff) | |
download | nextcloud-server-e1d324f7ebb311b1e0ed094ec13de43163d7cc68.tar.gz nextcloud-server-e1d324f7ebb311b1e0ed094ec13de43163d7cc68.zip |
Migrate lib/base.php to LoggerInterface
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/base.php')
-rw-r--r-- | lib/base.php | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/base.php b/lib/base.php index b216ef86f9b..751e6c305fb 100644 --- a/lib/base.php +++ b/lib/base.php @@ -78,6 +78,7 @@ use OCP\IUserSession; use OCP\Server; use OCP\Share; use OCP\User\Events\UserChangedEvent; +use Psr\Log\LoggerInterface; use function OCP\Log\logger; require_once 'public/Constants.php'; @@ -439,7 +440,7 @@ class OC { // if session can't be started break with http 500 error } catch (Exception $e) { - \OC::$server->getLogger()->logException($e, ['app' => 'base']); + Server::get(LoggerInterface::class)->error($e->getMessage(), ['app' => 'base','exception' => $e]); //show the user a detailed error page OC_Template::printExceptionErrorPage($e, 500); die(); @@ -810,8 +811,7 @@ class OC { if (!$isScssRequest) { http_response_code(400); - - \OC::$server->getLogger()->info( + Server::get(LoggerInterface::class)->info( 'Trusted domain error. "{remoteAddress}" tried to access using "{host}" as host.', [ 'app' => 'core', @@ -864,10 +864,9 @@ class OC { } catch (\Exception $e) { // a GC exception should not prevent users from using OC, // so log the exception - \OC::$server->getLogger()->logException($e, [ - 'message' => 'Exception when running cache gc.', - 'level' => ILogger::WARN, + Server::get(LoggerInterface::class)->warning('Exception when running cache gc.', [ 'app' => 'core', + 'exception' => $e, ]); } }); |