Add full_host in logger for HTTP(s) queries

This commit is contained in:
Damien Alexandre 2013-12-09 10:40:47 +01:00
commit ca507a5e34
4 changed files with 30 additions and 15 deletions

View file

@ -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;