Exemplo n.º 1
0
 public function routerStartup(Yaf\Request_Abstract $request, Yaf\Response_Abstract $response)
 {
     //记录请求信息
     $logger = Logkit\Logger::ins('_request');
     //增加web请求信息
     $processor = new Monolog\Processor\WebProcessor();
     $logger->pushProcessor($processor);
     $logger->info('', $request->getPost());
 }
Exemplo n.º 2
0
 public function errorAction()
 {
     try {
         throw $this->getRequest()->getException();
     } catch (Yaf\Exception\LoadFailed $e) {
         Rest::fail(Error::getMessage(Error::NOT_FOUND), Error::NOT_FOUND);
     } catch (Doctrine\DBAL\DBALException $e) {
         Rest::fail(Error::getMessage(Error::UNAVAILABLE), Error::UNAVAILABLE);
         $logger = Logkit\Logger::ins('_dbal');
         $logger->error($e->getMessage());
     } catch (Exception $e) {
         Rest::fail($e->getMessage(), $e->getCode());
         $logger = Logkit\Logger::ins('_exception');
         $logger->error($e->getMessage());
     }
     return false;
 }
Exemplo n.º 3
0
 public function errorAction($exception)
 {
     header('500 Internal Server Error', true, 500);
     try {
         throw $exception;
     } catch (Yaf\Exception\LoadFailed $e) {
         header('HTTP/1.0 404 Not Found', true, 404);
         $this->getView()->display('error/404.html');
     } catch (Doctrine\DBAL\DBALException $e) {
         $logger = Logkit\Logger::ins('_dbal');
         $logger->error($e->getMessage());
         $this->getView()->display('error/500.html');
     } catch (Exception $e) {
         $logger = Logkit\Logger::ins('_exception');
         $logger->error($e->getMessage());
         $this->getView()->display('error/500.html');
     }
     return false;
 }