Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / console / plugin / DarkConsoleErrorLogPlugin.php
bloba95bfd6f0de95840f86e3232f580f25127d1a2dc
1 <?php
3 final class DarkConsoleErrorLogPlugin extends DarkConsolePlugin {
5 public function getName() {
6 $count = count($this->getData());
7 if ($count) {
8 return pht('Error Log (%d)', $count);
10 return pht('Error Log');
13 public function getOrder() {
14 return 0;
17 public function getColor() {
18 if (count($this->getData())) {
19 return '#ff0000';
21 return null;
24 public function getDescription() {
25 return pht('Shows errors and warnings.');
28 public function generateData() {
29 return DarkConsoleErrorLogPluginAPI::getErrors();
32 public function renderPanel() {
33 $data = $this->getData();
35 $rows = array();
36 $details = array();
38 foreach ($data as $index => $row) {
39 $file = $row['file'];
40 $line = $row['line'];
42 $tag = javelin_tag(
43 'a',
44 array(
45 'sigil' => 'darkconsole-expand',
46 'meta' => array(
47 'expandID' => 'row-details-'.$index,
50 $row['str'].' at ['.basename($file).':'.$line.']');
51 $rows[] = array($tag);
53 $details[] = hsprintf(
54 '<div class="dark-console-panel-error-details" id="row-details-%s">'.
55 "%s\nStack trace:\n",
56 $index,
57 $row['details']);
59 foreach ($row['trace'] as $key => $entry) {
60 $line = '';
61 if (isset($entry['class'])) {
62 $line .= $entry['class'].'::';
64 $line .= idx($entry, 'function', '');
65 $href = null;
66 if (isset($entry['file'])) {
67 $line .= ' called at ['.$entry['file'].':'.$entry['line'].']';
70 $details[] = $line;
71 $details[] = "\n";
74 $details[] = hsprintf('</div>');
77 $table = new AphrontTableView($rows);
78 $table->setClassName('error-log');
79 $table->setHeaders(array(pht('Error')));
80 $table->setNoDataString(pht('No errors.'));
82 return phutil_tag(
83 'div',
84 array(),
85 array(
86 phutil_tag('div', array(), $table->render()),
87 phutil_tag('pre', array('class' => 'PhabricatorMonospaced'), $details),
88 ));