Example #1
0
 /**
  * Log the response received from server
  * 
  * @param  Spizer_Response $response
  * @see    Spizer_Logger_Interface::logResponse()
  * @return void
  */
 public function logResponse(Spizer_Response $response)
 {
     $this->_writer->startElement('response');
     $this->_writer->writeAttribute('microtime', microtime(true));
     $this->_writer->writeElement('status', $response->getStatus());
     $this->_writer->writeElement('message', $response->getMessage());
     // Log response headers
     if ($this->_config['logheaders']) {
         foreach ($response->getHeaders() as $header => $value) {
             $this->_logHeader($header, $value);
         }
     }
     $this->_writer->endElement();
     // response
 }
Example #2
0
 /**
  * Log response information
  *
  * @param Spizer_Response $response
  */
 public function logResponse(Spizer_Response $response)
 {
     $this->_db->insert('responses', array('microtime' => microtime(true), 'request_id' => $this->_currentReqId, 'statuscode' => $response->getStatus(), 'message' => $response->getMessage()));
     $stmt = $this->_db->prepare("INSERT INTO response_headers (request_id, header, value) VALUES ({$this->_currentReqId}, ?, ?)");
     foreach ($response->getAllHeaders() as $k => $v) {
         $stmt->execute(array($k, $v));
     }
 }