Browse Source

Add missing use for LoggerInterface

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
tags/v25.0.0beta1
Côme Chilliet 2 years ago
parent
commit
771028dada
No account linked to committer's email address
2 changed files with 4 additions and 2 deletions
  1. 1
    0
      apps/dav/lib/HookManager.php
  2. 3
    2
      remote.php

+ 1
- 0
apps/dav/lib/HookManager.php View File

use OCP\IUser; use OCP\IUser;
use OCP\IUserManager; use OCP\IUserManager;
use OCP\Util; use OCP\Util;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;


class HookManager { class HookManager {

+ 3
- 2
remote.php View File

use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin; use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
use Sabre\DAV\Exception\ServiceUnavailable; use Sabre\DAV\Exception\ServiceUnavailable;
use Sabre\DAV\Server; use Sabre\DAV\Server;
use Psr\Log\LoggerInterface;


/** /**
* Class RemoteException * Class RemoteException
$server = new Server(); $server = new Server();
if (!($e instanceof RemoteException)) { if (!($e instanceof RemoteException)) {
// we shall not log on 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) { $server->on('beforeMethod:*', function () use ($e) {
if ($e instanceof RemoteException) { if ($e instanceof RemoteException) {
// we shall not log on RemoteException // we shall not log on RemoteException
OC_Template::printErrorPage($e->getMessage(), '', $e->getCode()); OC_Template::printErrorPage($e->getMessage(), '', $e->getCode());
} else { } 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); OC_Template::printExceptionErrorPage($e, $statusCode);
} }
} }

Loading…
Cancel
Save