コード例 #1
0
 public function onMasterResponse(MWP_Event_MasterResponse $event)
 {
     $response = $event->getResponse();
     $content = $response->getContent();
     $status = 'unknown';
     if (is_array($content)) {
         if (array_key_exists('success', $content)) {
             $status = 'success';
         } elseif (array_key_exists('error', $content)) {
             $status = 'error';
         }
     }
     $this->logger->debug('Master response: {status}', array('status' => $status, 'content' => $content));
 }
コード例 #2
0
ファイル: SetErrorHandler.php プロジェクト: jimrucinski/Vine
 public function onMasterResponse(MWP_Event_MasterResponse $event)
 {
     if (!$this->logErrors) {
         return;
     }
     if (!$this->requestStack->getMasterRequest()->isAuthenticated() || count($this->errors) === 0) {
         return;
     }
     $response = $event->getResponse();
     $content = $response->getContent();
     if (!is_array($content)) {
         return;
     }
     $content['errorLog'] = array();
     foreach ($this->errors as $error) {
         /** @var DateTime $date */
         $date = $error['datetime'];
         $log = $error['context'];
         $log['level'] = $error['level_name'];
         $log['time'] = $date->format('Y-m-d H:i:s');
         $content['errorLog'][] = $log;
     }
     $response->setContent($content);
 }