Add full_host in logger for HTTP(s) queries
This commit is contained in:
parent
c97a4abceb
commit
ca507a5e34
4 changed files with 30 additions and 15 deletions
13
Client.php
13
Client.php
|
|
@ -4,6 +4,8 @@ namespace FOS\ElasticaBundle;
|
|||
|
||||
use Elastica\Client as ElasticaClient;
|
||||
use Elastica\Request;
|
||||
use Elastica\Transport\Http;
|
||||
use Elastica\Transport\Https;
|
||||
|
||||
/**
|
||||
* @author Gordon Franke <info@nevalon.de>
|
||||
|
|
@ -17,7 +19,16 @@ class Client extends ElasticaClient
|
|||
|
||||
if (null !== $this->_logger) {
|
||||
$time = microtime(true) - $start;
|
||||
$this->_logger->logQuery($path, $method, $data, $time);
|
||||
|
||||
$connection = $this->getLastRequest()->getConnection();
|
||||
$transport = $connection->getTransportObject();
|
||||
$full_host = null;
|
||||
|
||||
if ($transport instanceof Http || $transport instanceof Https) {
|
||||
$full_host = $connection->getTransport().'://'.$connection->getHost().':'.$connection->getPort();
|
||||
}
|
||||
|
||||
$this->_logger->logQuery($path, $method, $data, $time, $full_host);
|
||||
}
|
||||
|
||||
return $response;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue