You are here

public function UltimateCronErrorsSensorPlugin::resultVerbose in Monitoring 8

Provide additional info about sensor call.

This method is only executed on request. It is guaranteed that runSensor() is executed before this method.

Parameters

\Drupal\monitoring\Result\SensorResultInterface $result: Sensor result.

Return value

array Sensor call verbose info as render array.

Overrides ExtendedInfoSensorPluginInterface::resultVerbose

File

src/Plugin/monitoring/SensorPlugin/UltimateCronErrorsSensorPlugin.php, line 43

Class

UltimateCronErrorsSensorPlugin
Monitors the ultimate cron errors.

Namespace

Drupal\monitoring\Plugin\monitoring\SensorPlugin

Code

public function resultVerbose(SensorResultInterface $result) {
  $rows = [];
  foreach ($this->logEntries as $log_entry) {
    $rows[] = [
      'name' => $log_entry->job
        ->label() . ' (' . $log_entry->job
        ->getModuleName() . ')',
      'message' => strip_tags($log_entry->message),
      'logs' => Link::createFromRoute($this
        ->t('View logs'), 'entity.ultimate_cron_job.logs', [
        'ultimate_cron_job' => $log_entry->name,
      ]),
    ];
  }
  $header = [
    'name' => $this
      ->t('Cron job'),
    'message' => $this
      ->t('Message'),
    'logs' => $this
      ->t('Logs'),
  ];
  $output['log_entries'] = [
    '#type' => 'verbose_table_result',
    '#title' => $this
      ->t('Log entries'),
    '#header' => $header,
    '#rows' => $rows,
  ];
  return $output;
}