You are here

function monitoring_drush_result_output_table_single in Monitoring 7

Same name and namespace in other branches
  1. 8 monitoring.drush.inc \monitoring_drush_result_output_table_single()

Outputs single sensor result.

Parameters

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

1 call to monitoring_drush_result_output_table_single()
monitoring_drush_result_output_table in ./monitoring.drush.inc
Outputs human readable table with results.

File

./monitoring.drush.inc, line 378
Drush support for monitoring.

Code

function monitoring_drush_result_output_table_single(SensorResultInterface $result) {
  $rows[] = array(
    dt('Name'),
    $result
      ->getSensorInfo()
      ->getName(),
  );
  $rows[] = array(
    dt('Label'),
    $result
      ->getSensorInfo()
      ->getLabel(),
  );
  $rows[] = array(
    dt('Status'),
    $result
      ->getStatusLabel(),
  );
  $rows[] = array(
    dt('Message'),
    $result
      ->getMessage(),
  );
  $rows[] = array(
    dt('Execution time'),
    $result
      ->getExecutionTime() . 'ms',
  );
  $rows[] = array(
    dt('Result age'),
    format_interval(time() - $result
      ->getTimestamp()),
  );

  // Add the verbose output if requested.
  if ($result
    ->getVerboseOutput()) {
    $rows[] = array(
      dt('Verbose output'),
      $result
        ->getVerboseOutput(),
    );
  }
  drush_print_table($rows);
}