Example #1
0
 /**
  * Inits logger service for core.log
  *
  * @throws FrameworkException
  */
 private function initLogger()
 {
     // Check logir exists
     if (!file_exists(LOGDIR)) {
         throw new FrameworkException(sprintf('Logdir does not exist. Please create "%s" and make sure it is writable.', LOGDIR));
     }
     // Check logdir to be writable
     if (!is_writable(LOGDIR)) {
         throw new FrameworkException(sprintf('Logdir "%s" is not writable. Please set proper accessrights', LOGDIR));
     }
     $this->di->mapFactory('core.logger', '\\Core\\Logger\\Logger');
     /* @var $logger \Core\Logger\Logger */
     $this->logger = $this->di->get('core.logger');
     $this->logger->registerStream(new \Core\Logger\Streams\FileStream(LOGDIR . '/core.log'));
     $this->di->mapValue('core.logger.default', $this->logger);
 }