protected function SensorRunner::logResults in Monitoring 8
Same name and namespace in other branches
- 7 lib/Drupal/monitoring/SensorRunner.php \Drupal\monitoring\SensorRunner::logResults()
Log results if needed.
Parameters
\Drupal\monitoring\Result\SensorResultInterface[] $results: Results to be saved.
1 call to SensorRunner::logResults()
- SensorRunner::runSensors in src/
SensorRunner.php - Runs the defined sensors.
File
- src/
SensorRunner.php, line 219 - Contains \Drupal\monitoring\SensorRunner.
Class
- SensorRunner
- Instantiate and run requested sensors.
Namespace
Drupal\monitoringCode
protected function logResults(array $results) {
foreach ($results as $result) {
// Skip if the result is cached.
if ($result
->isCached()) {
continue;
}
$old_status = NULL;
// Try to load the previous log result for this sensor.
if ($result
->getPreviousResult()) {
$old_status = $result
->getPreviousResult()
->getStatus();
}
// Check if we need to log the result.
if ($this
->needsLogging($result, $old_status, $result
->getStatus())) {
monitoring_sensor_result_save($result);
}
}
}