File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -127,12 +127,25 @@ public function totalTime(): float
127127 */
128128 public function log ($ level , string |Stringable $ message , array $ context = []): void
129129 {
130- $ query = $ context ['query ' ];
130+ $ query = $ context ['query ' ] ?? null ;
131131
132132 if ($ this ->_logger ) {
133133 $ this ->_logger ->log ($ level , $ message , $ context );
134134 }
135135
136+ // This specific to Elastic Search
137+ if (isset ($ context ['request ' ]) && isset ($ context ['response ' ])) {
138+ $ this ->_totalTime += $ context ['response ' ]['took ' ];
139+
140+ $ this ->_queries [] = [
141+ 'query ' => $ context ['request ' ],
142+ 'took ' => $ context ['response ' ]['took ' ],
143+ 'rows ' => $ context ['response ' ]['hits ' ]['total ' ],
144+ ];
145+
146+ return ;
147+ }
148+
136149 if (
137150 !$ query instanceof LoggedQuery ||
138151 ($ this ->_includeSchema === false && $ this ->isSchemaQuery ($ query ))
You can’t perform that action at this time.
0 commit comments