Skip to content

Commit

Permalink
Improved log panel display.
Browse files Browse the repository at this point in the history
  • Loading branch information
qiangxue committed Jul 10, 2013
1 parent 4ec0a61 commit 389c0e2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion framework/yii/base/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function runWithParams($params)
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;
}
Expand Down
2 changes: 1 addition & 1 deletion framework/yii/base/InlineAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct($id, $controller, $actionMethod, $config = array())
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;
}
Expand Down
21 changes: 10 additions & 11 deletions framework/yii/debug/panels/LogPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,25 @@ public function getName()

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);
$url = $this->getUrl();
return <<<EOD
$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()
Expand Down

0 comments on commit 389c0e2

Please sign in to comment.