diff --git a/task/hosting_task.module b/task/hosting_task.module index 25d74eb..69d08b8 100644 --- a/task/hosting_task.module +++ b/task/hosting_task.module @@ -1086,9 +1086,12 @@ function hosting_task_view($node, $teaser = FALSE, $page = FALSE) { function _hosting_task_log_table($node, $last_position = 0) { $result = db_query("SELECT * FROM {hosting_task_log} WHERE vid = :vid AND lid > :lid ORDER BY lid", array(':vid' => $node->vid, ':lid' => $last_position)); if ($result) { - $header = array('data' => 'Log message'); + $headers = array('data' => 'Log message', 'execution_time' => 'Execution time'); $rows = array(); $last_lid = $last_position; + $last_timestamp = 0; + $exec_time = ''; + $row_count = -1; foreach ($result as $entry) { if (strlen($entry->message) > 300) { $summary = "" . filter_xss(substr($entry->message, 0, 75), array()) . "... (" . t('Expand') . ')'; @@ -1097,6 +1100,7 @@ function _hosting_task_log_table($node, $last_position = 0) { else { $message = filter_xss($entry->message); } + // Add error and warning anchors, so we can provide a quick link to them. if ($entry->type == 'error') { $message = '' . $message; @@ -1104,21 +1108,46 @@ function _hosting_task_log_table($node, $last_position = 0) { elseif ($entry->type == 'warning') { $message = '' . $message; } - $row = array(array( + + // Add the exec_time to the previous row + $exec_time = $entry->timestamp - $last_timestamp; + + // "1" is unreliable because timestamps don't allow sub-second granularity + if ($exec_time <= 1) { + $exec_time = '-'; + } + else { + $exec_time = '' . $exec_time . ' s.'; + } + + if ($row_count > -1) { + $rows[$row_count]['data'][] = array( + 'data' => $exec_time, + ); + } + + $row_count++; + $last_timestamp = $entry->timestamp; + + $row = array( + array( 'data' => $message, 'class' => array('hosting-status'), - )); + ), + ); + $rows[] = array( 'data' => $row, 'class' => array(_hosting_task_log_class($entry->type)), ); + // Record that we've seen this log row. $last_lid = $entry->lid; } return array( '#theme' => "table", - '#header' => $header, + '#header' => $headers, '#rows' => $rows, '#attributes' => array( 'id' => 'hosting-task-log',