getUrl() public method

Gets URL
public getUrl ( ) : string
return string Returns URL
Exemplo n.º 1
0
 /**
  * Logs failed requests data
  *
  * @param   Request     $request    API request data
  * @param   Response    $response   API response data
  */
 public function logError(Request $request, Response $response)
 {
     if ($this->enabled && !empty($this->writer)) {
         try {
             $time = time();
             $status = $response->getStatus();
             $data = ["tag" => $this->defaultTag, "dateTime" => $time, "message" => $status, "extra" => ['request' => ['remote_ip' => $request->getIp(), 'method' => $request->getMethod(), 'url' => $request->getUrl() . $request->getPath(), 'headers' => $request->headers(), 'body' => $request->getBody()], 'response' => $response->finalize(), 'tags' => [$this->defaultTag, $status], 'time' => $time], "type" => "ApiLog"];
             $this->writer->send($data);
         } catch (Exception $e) {
             \Scalr::logException(new Exception(sprintf("Api logger could not save the record: %s", $e->getMessage()), $e->getCode(), $e));
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Logs failed requests data
  *
  * @param   Request     $request    API request data
  * @param   Response    $response   API response data
  *
  * @return array   Returns array of the fields to log
  */
 protected function handlerApiError(Request $request, Response $response)
 {
     $data = ['.request.method' => $request->getMethod(), '.request.url' => $request->getUrl() . $request->getPath(), '.request.headers' => $request->headers(), '.request.body' => $request->getBody(), '.response.status' => $response->getStatus(), '.response.headers' => $response->getHeaders(), '.response.body' => $response->getBody()];
     return $data;
 }