1 | <?php |
||
15 | class ElasticaLogger implements LoggerInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var LoggerInterface |
||
19 | */ |
||
20 | protected $logger; |
||
21 | |||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | protected $queries = array(); |
||
26 | |||
27 | /** |
||
28 | * @var boolean |
||
29 | */ |
||
30 | protected $debug; |
||
31 | |||
32 | /** |
||
33 | * Constructor. |
||
34 | * |
||
35 | * @param LoggerInterface|null $logger The Symfony logger |
||
36 | * @param boolean $debug |
||
37 | */ |
||
38 | 15 | public function __construct(LoggerInterface $logger = null, $debug = false) |
|
43 | |||
44 | /** |
||
45 | * Logs a query. |
||
46 | * |
||
47 | * @param string $path Path to call |
||
48 | * @param string $method Rest method to use (GET, POST, DELETE, PUT) |
||
49 | * @param array $data Arguments |
||
50 | * @param float $time Execution time |
||
51 | * @param array $connection Host, port, transport, and headers of the query |
||
52 | * @param array $query Arguments |
||
53 | */ |
||
54 | 4 | public function logQuery($path, $method, $data, $time, $connection = array(), $query = array(), $engineTime = 0, $itemCount = 0) |
|
77 | |||
78 | /** |
||
79 | * Returns the number of queries that have been logged. |
||
80 | * |
||
81 | * @return integer The number of queries logged |
||
82 | */ |
||
83 | 3 | public function getNbQueries() |
|
87 | |||
88 | /** |
||
89 | * Returns a human-readable array of queries logged. |
||
90 | * |
||
91 | * @return array An array of queries |
||
92 | */ |
||
93 | 1 | public function getQueries() |
|
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | 1 | public function emergency($message, array $context = array()) |
|
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | 1 | public function alert($message, array $context = array()) |
|
113 | |||
114 | /** |
||
115 | * {@inheritdoc} |
||
116 | */ |
||
117 | 1 | public function critical($message, array $context = array()) |
|
121 | |||
122 | /** |
||
123 | * {@inheritdoc} |
||
124 | */ |
||
125 | 1 | public function error($message, array $context = array()) |
|
129 | |||
130 | /** |
||
131 | * {@inheritdoc} |
||
132 | */ |
||
133 | 1 | public function warning($message, array $context = array()) |
|
137 | |||
138 | /** |
||
139 | * {@inheritdoc} |
||
140 | */ |
||
141 | 1 | public function notice($message, array $context = array()) |
|
145 | |||
146 | /** |
||
147 | * {@inheritdoc} |
||
148 | */ |
||
149 | 1 | public function info($message, array $context = array()) |
|
153 | |||
154 | /** |
||
155 | * {@inheritdoc} |
||
156 | */ |
||
157 | 1 | public function debug($message, array $context = array()) |
|
161 | |||
162 | /** |
||
163 | * {@inheritdoc} |
||
164 | */ |
||
165 | 1 | public function log($level, $message, array $context = array()) |
|
169 | } |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.