You are here

function _rules_show_log in Rules 6

2 calls to _rules_show_log()
rules_show_log in rules/rules.module
Shows the log and clears it afterwards
rules_test_show_log in rules_test/rules_test.module
Returns the log and clears it afterwards

File

rules/rules.module, line 704
Rules engine module

Code

function _rules_show_log(&$i, $data, &$error) {
  $start =& $data[0]['time'];
  $output = array();
  while ($i < count($data)) {
    if ($output && isset($data[$i]['start']) && $data[$i]['start']) {

      //the next entry stems from another evaluated set, add in its log messages here
      $output[] = _rules_show_log($i, $data, $error);
    }
    else {
      $diff = $data[$i]['time']['sec'] - $start['sec'] + $data[$i]['time']['usec'] - $start['usec'];
      $formatted_diff = round($diff * 1000, 3) . ' ms';
      $msg = $formatted_diff . ' ' . $data[$i]['msg'];
      if ($data[$i]['error']) {
        $error = TRUE;
        $msg = '<strong>' . $msg . '</strong>';
      }
      $output[] = $msg;
      if (isset($data[$i]['start']) && !$data[$i]['start']) {

        //this was the last log entry of this set
        return theme('item_list', $output);
      }
    }
    $i++;
  }
  return theme('item_list', $output);
}