use OC\Files\Filesystem;
use OC\Files\View;
use OCP\ICache;
-use OCP\ILogger;
use OCP\Security\ISecureRandom;
+use Psr\Log\LoggerInterface;
class File implements ICache {
$this->storage = new View('/' . $user->getUID() . '/cache');
return $this->storage;
} else {
- \OCP\Util::writeLog('core', 'Can\'t get cache storage, user not logged in', ILogger::ERROR);
+ \OC::$server->get(LoggerInterface::class)->error('Can\'t get cache storage, user not logged in', ['app' => 'core']);
throw new \OC\ForbiddenException('Can\t get cache storage, user not logged in');
}
}
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 {
* 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
* 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 {
$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 = [];
use OCP\IConfig;
use OCP\IDateTimeZone;
-use OCP\ILogger;
use OCP\ISession;
+use Psr\Log\LoggerInterface;
class DateTimeZone implements IDateTimeZone {
/** @var IConfig */
try {
return new \DateTimeZone($timeZone);
} catch (\Exception $e) {
- \OCP\Util::writeLog('datetimezone', 'Failed to created DateTimeZone "' . $timeZone . "'", ILogger::DEBUG);
+ \OC::$server->get(LoggerInterface::class)->debug('Failed to created DateTimeZone "' . $timeZone . '"', ['app' => 'datetimezone']);
return new \DateTimeZone($this->getDefaultTimeZone());
}
}
}
// No timezone found, fallback to UTC
- \OCP\Util::writeLog('datetimezone', 'Failed to find DateTimeZone for offset "' . $offset . "'", ILogger::DEBUG);
+ \OC::$server->get(LoggerInterface::class)->debug('Failed to find DateTimeZone for offset "' . $offset . '"', ['app' => 'datetimezone']);
return new \DateTimeZone($this->getDefaultTimeZone());
}
}