Commit 389c0e2b by Qiang Xue

Improved log panel display.

parent 4ec0a61a
...@@ -77,7 +77,7 @@ class Action extends Component ...@@ -77,7 +77,7 @@ class Action extends Component
throw new InvalidConfigException(get_class($this) . ' must define a "run()" method.'); throw new InvalidConfigException(get_class($this) . ' must define a "run()" method.');
} }
$args = $this->controller->bindActionParams($this, $params); $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) { if (Yii::$app->requestedParams === null) {
Yii::$app->requestedParams = $args; Yii::$app->requestedParams = $args;
} }
......
...@@ -46,7 +46,7 @@ class InlineAction extends Action ...@@ -46,7 +46,7 @@ class InlineAction extends Action
public function runWithParams($params) public function runWithParams($params)
{ {
$args = $this->controller->bindActionParams($this, $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) { if (Yii::$app->requestedParams === null) {
Yii::$app->requestedParams = $args; Yii::$app->requestedParams = $args;
} }
......
...@@ -26,26 +26,25 @@ class LogPanel extends Panel ...@@ -26,26 +26,25 @@ class LogPanel extends Panel
public function getSummary() 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)); $errorCount = count(Target::filterMessages($this->data['messages'], Logger::LEVEL_ERROR));
if ($errorCount) { 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)); $warningCount = count(Target::filterMessages($this->data['messages'], Logger::LEVEL_WARNING));
if ($warningCount) { 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('&nbsp;', $output);
$log = implode(', ', $output); $url = $this->getUrl();
$url = $this->getUrl(); return <<<EOD
return <<<EOD
<div class="yii-debug-toolbar-block"> <div class="yii-debug-toolbar-block">
<a href="$url">$log</a> <a href="$url" title="$title">Log: $log</a>
</div> </div>
EOD; EOD;
} else {
return '';
}
} }
public function getDetail() public function getDetail()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment