コード例 #1
0
ファイル: RawLog.php プロジェクト: SandeepUmredkar/PortalSMIP
 public function processResponse(Zend_Http_Response $response)
 {
     parent::processResponse($response);
     $data[] = $this->_path;
     $data[] = 'RESPONSE';
     $data[] = round($this->getRestService()->getLastResultTimeSpent() * 1000) . 'ms';
     $data[] = App_Util_String::formatBytes($this->_lastMessageSize);
     $data[] = $response->getStatus();
     if ($this->getLogResponseBody()) {
         $body = $response->getBody();
         if ($body) {
             $data[] = "\n" . $this->_processLogMessage($body);
         } else {
             $data[] = "No body data";
         }
     }
     $this->getLogger()->log(implode(' | ', $data), Zend_Log::INFO);
     return $this;
 }
コード例 #2
0
 public function processResponseData(&$response)
 {
     if ($response instanceof \DrSlump\Protobuf\Message) {
         $data = $this->_prepareData($response);
         $data[] = 'RESPONSE';
         $data[] = round($this->getRestService()->getLastResultTimeSpent() * 1000) . 'ms';
         $data[] = App_Util_String::formatBytes($this->_lastMessageSize);
         if ($this->getLogResponseBody()) {
             if ($this->_lastMessageSize < $this->getMessageSizeLimit()) {
                 $codec = new \DrSlump\Protobuf\Codec\TextFormat();
                 $out = $codec->encode($response);
                 $data[] = get_class($response) . "\n" . $out;
             } else {
                 $data[] = "\nData message is too big to log. Sorry...";
             }
         }
         $this->getLogger()->log(implode(' | ', $data), Zend_Log::INFO);
     }
     return $this;
 }