Add missing use for LoggerInterface

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2022-03-31 16:25:31 +02:00
parent 5fb9de6248
commit 771028dada
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
2 changed files with 4 additions and 2 deletions

View File

@ -35,6 +35,7 @@ use OCP\Defaults;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Util;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class HookManager {

View File

@ -36,6 +36,7 @@ require_once __DIR__ . '/lib/versioncheck.php';
use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
use Sabre\DAV\Exception\ServiceUnavailable;
use Sabre\DAV\Server;
use Psr\Log\LoggerInterface;
/**
* Class RemoteException
@ -57,7 +58,7 @@ function handleException($e) {
$server = new Server();
if (!($e instanceof RemoteException)) {
// we shall not log on RemoteException
$server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->getLogger()));
$server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->get(LoggerInterface::class)));
}
$server->on('beforeMethod:*', function () use ($e) {
if ($e instanceof RemoteException) {
@ -82,7 +83,7 @@ function handleException($e) {
// we shall not log on RemoteException
OC_Template::printErrorPage($e->getMessage(), '', $e->getCode());
} else {
\OC::$server->getLogger()->logException($e, ['app' => 'remote']);
\OC::$server->get(LoggerInterface::class)->error($e->getMessage(), ['app' => 'remote','exception' => $e]);
OC_Template::printExceptionErrorPage($e, $statusCode);
}
}