forked from FriendsOfSymfony/FOSElasticaBundle
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathClient.php
More file actions
32 lines (25 loc) · 710 Bytes
/
Client.php
File metadata and controls
32 lines (25 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
namespace FOQ\ElasticaBundle;
use Elastica_Client;
use FOQ\ElasticaBundle\Logger\ElasticaLogger;
/**
* @author Gordon Franke <info@nevalon.de>
*/
class Client extends Elastica_Client
{
protected $logger;
public function setLogger(ElasticaLogger $logger)
{
$this->logger = $logger;
}
public function request($path, $method, $data = array(), array $query = array())
{
$start = microtime(true);
$response = parent::request($path, $method, $data, $query);
if (null !== $this->logger) {
$time = microtime(true) - $start;
$this->logger->logQuery($path, $method, $data, $time);
}
return $response;
}
}