| Conditions | 3 | 
| Paths | 3 | 
| Total Lines | 24 | 
| Code Lines | 17 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 35 | public function saveSolrLog($type = 'Query', $index = null): void | ||
| 36 |     { | ||
| 37 |         $response = $this->client->request('GET', 'solr/admin/info/logging', [ | ||
| 38 | 'query' => [ | ||
| 39 | 'since' => 0, | ||
| 40 | 'wt' => 'json' | ||
| 41 | ] | ||
| 42 | ]); | ||
| 43 | |||
| 44 | $arrayResponse = json_decode($response, true); | ||
| 45 | |||
| 46 |         foreach ($arrayResponse['history']['docs'] as $error) { | ||
| 47 | $filter = [ | ||
| 48 | 'Timestamp' => $error['time'], | ||
| 49 | 'Level' => $error['level'] | ||
| 50 | ]; | ||
| 51 |             if (!SolrLog::get()->filter($filter)->first()) { | ||
| 52 | SolrLog::create([ | ||
| 53 | 'Timestamp' => $error['time'], | ||
| 54 | 'Message' => $error['message'], | ||
| 55 | 'Index' => $index, | ||
| 56 | 'Type' => $type, | ||
| 57 | 'Level' => $error['level'], | ||
| 58 | ])->write(); | ||
| 59 | } | ||
| 63 |