Browse Source

Improved log panel display.

tags/2.0.0-beta
Qiang Xue 12 years ago
parent
commit
389c0e2bb6
  1. 2
      framework/yii/base/Action.php
  2. 2
      framework/yii/base/InlineAction.php
  3. 17
      framework/yii/debug/panels/LogPanel.php

2
framework/yii/base/Action.php

@ -77,7 +77,7 @@ class Action extends Component
throw new InvalidConfigException(get_class($this) . ' must define a "run()" method.');
}
$args = $this->controller->bindActionParams($this, $params);
Yii::info('Running "' . get_class($this) . '::run()" with parameters: ' . var_export($args, true), __METHOD__);
Yii::info('Running action: ' . get_class($this) . '::run()', __METHOD__);
if (Yii::$app->requestedParams === null) {
Yii::$app->requestedParams = $args;
}

2
framework/yii/base/InlineAction.php

@ -46,7 +46,7 @@ class InlineAction extends Action
public function runWithParams($params)
{
$args = $this->controller->bindActionParams($this, $params);
Yii::info("Running '" . get_class($this->controller) . '::' . $this->actionMethod . "()' with parameters: " . var_export($args, true), __METHOD__);
Yii::info('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__);
if (Yii::$app->requestedParams === null) {
Yii::$app->requestedParams = $args;
}

17
framework/yii/debug/panels/LogPanel.php

@ -26,26 +26,25 @@ class LogPanel extends Panel
public function getSummary()
{
$output = array();
$output = array('<span class="label">' . count($this->data['messages']) . '</span>');
$title = 'Logged ' . count($this->data['messages']) . ' messages';
$errorCount = count(Target::filterMessages($this->data['messages'], Logger::LEVEL_ERROR));
if ($errorCount) {
$output[] = '<span class="label label-important">' . $errorCount . '</span> ' . ($errorCount > 1 ? 'errors' : 'error');
$output[] = '<span class="label label-important">' . $errorCount . '</span>';
$title .= ", $errorCount errors";
}
$warningCount = count(Target::filterMessages($this->data['messages'], Logger::LEVEL_WARNING));
if ($warningCount) {
$output[] = '<span class="label label-warning">' . $warningCount . '</span> ' . ($warningCount > 1 ? 'warnings' : 'warning');
$output[] = '<span class="label label-warning">' . $warningCount . '</span>';
$title .= ", $warningCount warnings";
}
if (!empty($output)) {
$log = implode(', ', $output);
$log = implode('&nbsp;', $output);
$url = $this->getUrl();
return <<<EOD
<div class="yii-debug-toolbar-block">
<a href="$url">$log</a>
<a href="$url" title="$title">Log: $log</a>
</div>
EOD;
} else {
return '';
}
}
public function getDetail()

Loading…
Cancel
Save