/** * @param Request $request * @param Response $response */ public function terminate(Request $request, Response $response) { $logger = $this->loggerFactory->create('app.request'); $routeName = $request->attributes->get('_route'); $logger->notice(sprintf('Route %s matched', $routeName), array('route' => $routeName, 'response_code' => $response->getStatusCode(), 'response_size' => strlen($response->getContent()))); $this->loggerFactory->flushBuffer(); if ($this->app instanceof TerminableInterface) { $this->app->terminate($request, $response); } }
public function boot() { if (true === $this->booted) { return; } $this->internalConfig = $this->getContainerConfiguration($this->containerConfigPath)->load(); $this->config = new ParameterBag($this->internalConfig['parameters']); $this->config->set('debug', !$this->config->get('production_mode', true)); if (null === $this->config->get('root_dir')) { throw new BadConfigurationException('You should define root_dir in config'); } $logDir = $this->config->get('log_dir'); if (null === $logDir) { $this->config->set('log_dir', $this->config->get('root_dir') . '../log'); } $this->loggerFactory = new LoggerFactory($this->getConfig()->get('debug'), $this->config->get('log_dir')); $appLogger = $this->loggerFactory->create('app'); if (false === $this->config->get('debug')) { error_reporting(E_ALL & ~E_USER_DEPRECATED & ~E_DEPRECATED & ~E_NOTICE); ini_set('display_errors', 'Off'); } else { error_reporting(E_ALL); ini_set('display_errors', 'On'); } ErrorHandler::register($appLogger, $this->errorLevelMap); $this->booted = true; }