diff options
Diffstat (limited to 'lib/private/Dashboard/Manager.php')
-rw-r--r-- | lib/private/Dashboard/Manager.php | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/private/Dashboard/Manager.php b/lib/private/Dashboard/Manager.php index a77c389cdeb..9f94a6e8f92 100644 --- a/lib/private/Dashboard/Manager.php +++ b/lib/private/Dashboard/Manager.php @@ -30,9 +30,9 @@ use InvalidArgumentException; use OCP\AppFramework\QueryException; use OCP\Dashboard\IManager; use OCP\Dashboard\IWidget; -use OCP\ILogger; use OCP\IServerContainer; use Throwable; +use Psr\Log\LoggerInterface; class Manager implements IManager { @@ -72,10 +72,10 @@ class Manager implements IManager { * There is a circular dependency between the logger and the registry, so * we can not inject it. Thus the static call. */ - \OC::$server->getLogger()->logException($e, [ - 'message' => 'Could not load lazy dashbaord widget: ' . $e->getMessage(), - 'level' => ILogger::FATAL, - ]); + \OC::$server->get(LoggerInterface::class)->critical( + 'Could not load lazy dashboard widget: ' . $e->getMessage(), + ['excepiton' => $e] + ); } /** * Try to register the loaded reporter. Theoretically it could be of a wrong @@ -88,10 +88,10 @@ class Manager implements IManager { * There is a circular dependency between the logger and the registry, so * we can not inject it. Thus the static call. */ - \OC::$server->getLogger()->logException($e, [ - 'message' => 'Could not register lazy dashboard widget: ' . $e->getMessage(), - 'level' => ILogger::FATAL, - ]); + \OC::$server->get(LoggerInterface::class)->critical( + 'Could not register lazy dashboard widget: ' . $e->getMessage(), + ['excepiton' => $e] + ); } try { @@ -100,16 +100,17 @@ class Manager implements IManager { $endTime = microtime(true); $duration = $endTime - $startTime; if ($duration > 1) { - \OC::$server->getLogger()->error('Dashboard widget {widget} took {duration} seconds to load.', [ + \OC::$server->get(LoggerInterface::class)->error( + 'Dashboard widget {widget} took {duration} seconds to load.', [ 'widget' => $widget->getId(), 'duration' => round($duration, 2), ]); } } catch (Throwable $e) { - \OC::$server->getLogger()->logException($e, [ - 'message' => 'Error during dashboard widget loading: ' . $e->getMessage(), - 'level' => ILogger::FATAL, - ]); + \OC::$server->get(LoggerInterface::class)->critical( + 'Error during dashboard widget loading: ' . $e->getMessage(), + ['excepiton' => $e] + ); } } $this->lazyWidgets = []; |