/** * Log the request object * * @param Spizer_Request $request * @see Spizer_Logger_Interface::logRequest() */ public function logRequest(Spizer_Request $request) { $this->_writer->startElement('request'); $this->_writer->writeAttribute('microtime', microtime(true)); $this->_writer->writeElement('uri', $request->getUri()); $this->_writer->writeElement('method', $request->getMethod()); $ref = $request->getReferrer(); if ($ref) { $this->_writer->writeElement('referrer', $ref); } if ($this->_config['logheaders']) { foreach ($request->getAllHeaders() as $header => $value) { $this->_logHeader($header, $value); } } $this->_writer->endElement(); // request }
/** * Log request information * * @param Spizer_Request $request */ public function logRequest(Spizer_Request $request) { $this->_db->insert('requests', array('microtime' => microtime(true), 'url' => $request->getUri(), 'referrer' => $request->getReferrer(), 'method' => $request->getMethod())); $this->_currentReqId = $this->_db->lastInsertId('requests', 'id'); $stmt = $this->_db->prepare("INSERT INTO request_headers (request_id, header, value) VALUES ({$this->_currentReqId}, ?, ?)"); foreach ($request->getAllHeaders() as $k => $v) { $stmt->execute(array($k, $v)); } }