add logger explicit;cleanup;correct cs
This commit is contained in:
parent
30e3d67cb6
commit
82b82b1908
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace FOQ\ElasticaBundle;
|
namespace FOQ\ElasticaBundle;
|
||||||
|
|
||||||
use Elastica_Client;
|
use Elastica_Client;
|
||||||
|
@ -8,13 +9,18 @@ use Elastica_Client;
|
||||||
*/
|
*/
|
||||||
class Client extends Elastica_Client
|
class Client extends Elastica_Client
|
||||||
{
|
{
|
||||||
|
protected $logger;
|
||||||
|
|
||||||
public function setLogger($logger)
|
public function setLogger($logger)
|
||||||
{
|
{
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function request($path, $method, $data = array()) {
|
public function request($path, $method, $data = array())
|
||||||
|
{
|
||||||
|
if (null !== $this->logger) {
|
||||||
$this->logger->logQuery($path, $method, $data);
|
$this->logger->logQuery($path, $method, $data);
|
||||||
|
}
|
||||||
|
|
||||||
return parent::request($path, $method, $data);
|
return parent::request($path, $method, $data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace FOQ\ElasticaBundle\DataCollector;
|
namespace FOQ\ElasticaBundle\DataCollector;
|
||||||
|
|
||||||
use FOQ\ElasticaBundle\Logger\ElasticaLogger;
|
use FOQ\ElasticaBundle\Logger\ElasticaLogger;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace FOQ\ElasticaBundle\Logger;
|
namespace FOQ\ElasticaBundle\Logger;
|
||||||
|
|
||||||
use Symfony\Component\HttpKernel\Log\LoggerInterface;
|
use Symfony\Component\HttpKernel\Log\LoggerInterface;
|
||||||
|
@ -70,5 +71,4 @@ class ElasticaLogger
|
||||||
{
|
{
|
||||||
return $this->queries;
|
return $this->queries;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
<call method="setLogger">
|
<call method="setLogger">
|
||||||
<argument type="service" id="elastica.logger" />
|
<argument type="service" id="elastica.logger" />
|
||||||
</call>
|
</call>
|
||||||
<tag name="monolog.logger" channel="elastica" />
|
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="foq_elastica.index_manager" class="FOQ\ElasticaBundle\IndexManager">
|
<service id="foq_elastica.index_manager" class="FOQ\ElasticaBundle\IndexManager">
|
||||||
|
|
Loading…
Reference in a new issue