protected function SensorRunner::logResults in Monitoring 7
Same name and namespace in other branches
- 8 src/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 lib/
Drupal/ monitoring/ SensorRunner.php - Runs the defined sensors.
File
- lib/
Drupal/ monitoring/ SensorRunner.php, line 229 - 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 ($last_result = monitoring_sensor_result_last($result
->getSensorName())) {
$old_status = $last_result->sensor_status;
}
// Check if we need to log the result.
if ($this
->needsLogging($result, $old_status, $result
->getStatus())) {
monitoring_sensor_result_save($result);
}
}
}