1 | <?php |
||
25 | class ElasticaLogger extends AbstractLogger |
||
26 | { |
||
27 | /** |
||
28 | * @var LoggerInterface |
||
29 | */ |
||
30 | protected $logger; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $queries = []; |
||
36 | |||
37 | /** |
||
38 | * @var bool |
||
39 | */ |
||
40 | protected $debug; |
||
41 | |||
42 | 33 | public function __construct(?LoggerInterface $logger = null, bool $debug = false) |
|
47 | |||
48 | /** |
||
49 | * Logs a query. |
||
50 | * |
||
51 | * @param string $path Path to call |
||
52 | * @param string $method Rest method to use (GET, POST, DELETE, PUT) |
||
53 | * @param array|string $data Arguments |
||
54 | * @param float $queryTime Execution time (in seconds) |
||
55 | * @param array $connection Host, port, transport, and headers of the query |
||
56 | * @param array $query Arguments |
||
57 | * @param int $engineTime |
||
58 | */ |
||
59 | 19 | public function logQuery(string $path, string $method, $data, $queryTime, $connection = [], $query = [], $engineTime = 0, int $itemCount = 0) |
|
95 | |||
96 | /** |
||
97 | * Returns the number of queries that have been logged. |
||
98 | */ |
||
99 | 5 | public function getNbQueries(): int |
|
103 | |||
104 | /** |
||
105 | * Returns a human-readable array of queries logged. |
||
106 | */ |
||
107 | 5 | public function getQueries(): array |
|
111 | |||
112 | /** |
||
113 | * {@inheritdoc} |
||
114 | */ |
||
115 | 20 | public function log($level, $message, array $context = []) |
|
119 | |||
120 | public function reset() |
||
124 | } |
||
125 |