function RulesLog::renderHelper

Renders the log of one event invocation.

1 call to RulesLog::renderHelper()
RulesLog::render in includes/rules.core.inc
Renders the whole log.

File

includes/rules.core.inc, line 2792

Class

RulesLog
The rules default logging class.

Code

protected function renderHelper(&$line = 0) {
    $startTime = isset($this->log[$line][3]) ? $this->log[$line][3] : 0;
    $output = array();
    while ($line < count($this->log)) {
        if ($output && !empty($this->log[$line][4])) {
            // The next entry stems from another evaluated set, add in its log
            // messages here.
            $vars['head'] = t($this->log[$line][0], $this->log[$line][1]);
            if (isset($this->log[$line][5])) {
                $vars['link'] = '[' . l(t('edit'), $this->log[$line][5]) . ']';
            }
            $vars['log'] = $this->renderHelper($line);
            $output[] = theme('rules_debug_element', $vars);
        }
        else {
            $formatted_diff = round(($this->log[$line][3] - $startTime) * 1000, 3) . ' ms';
            $msg = $formatted_diff . ' ' . t($this->log[$line][0], $this->log[$line][1]);
            if ($this->log[$line][2] >= RulesLog::WARN) {
                $level = $this->log[$line][2] == RulesLog::WARN ? 'warn' : 'error';
                $msg = '<span class="rules-debug-' . $level . '">' . $msg . '</span>';
            }
            if (isset($this->log[$line][5]) && !isset($this->log[$line][4])) {
                $msg .= ' [' . l(t('edit'), $this->log[$line][5]) . ']';
            }
            $output[] = $msg;
            if (isset($this->log[$line][4]) && !$this->log[$line][4]) {
                // This was the last log entry of this set.
                return theme('item_list', array(
                    'items' => $output,
                ));
            }
        }
        $line++;
    }
    return theme('item_list', array(
        'items' => $output,
    ));
}