container['signal-handler']; } /** * @return TaskManager */ protected function getTaskManager() { return $this->container['task-manager']; } /** * @return array */ protected function getLoggerConfiguration() { return $this->container['task-manager.logger.configuration']; } /** * @return LogFileFactory */ protected function getTaskManagerLogFileFactory() { return $this->container['task-manager.log-file.factory']; } protected function assertTaskManagerIsEnabled() { if (false === $this->container['phraseanet.configuration']['main']['task-manager']['enabled']) { throw new RuntimeException('The use of the task manager is disabled on this instance.'); } } /** * @param callable $fileLocator Callable returning LogFileInterface when called */ protected function configureLogger(callable $fileLocator) { $configuration = $this->getLoggerConfiguration(); if ($configuration['enabled']) { /** @var LogFileInterface $file */ $file = $fileLocator(); Assertion::isInstanceOf($file, LogFileInterface::class); $handler = new RotatingFileHandler($file->getPath(), $configuration['max-files'], $configuration['level']); $this->getTaskManagerLogger()->pushHandler($handler); } } }