From 94e94e0a8566f23d16658a04c55b0bbfdd6689aa Mon Sep 17 00:00:00 2001 From: "godzilla80@gmx.net" <> Date: Sun, 14 Feb 2010 01:22:57 +0000 Subject: Merge Branches & Trunk /trunk:r2680,2692,2707-2736 /branches/3.1:r2682-2686,2694-2702,2705,2738-2762 --- framework/Util/TLogRouter.php | 87 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 78 insertions(+), 9 deletions(-) (limited to 'framework/Util/TLogRouter.php') diff --git a/framework/Util/TLogRouter.php b/framework/Util/TLogRouter.php index a8f42b56..c944e17d 100644 --- a/framework/Util/TLogRouter.php +++ b/framework/Util/TLogRouter.php @@ -635,6 +635,11 @@ class TEmailLogRoute extends TLogRoute */ class TBrowserLogRoute extends TLogRoute { + /** + * @var string css class for indentifying the table structure in the dom tree + */ + private $_cssClass=null; + public function processLogs($logs) { if(empty($logs) || $this->getApplication()->getMode()==='Performance') return; @@ -659,10 +664,43 @@ class TBrowserLogRoute extends TLogRoute } $response->write($this->renderFooter()); } + + /** + * @param string the css class of the control + */ + public function setCssClass($value) + { + $this->_cssClass = TPropertyValue::ensureString($value); + } + + /** + * @return string the css class of the control + */ + public function getCssClass() + { + return TPropertyValue::ensureString($this->_cssClass); + } protected function renderHeader() { - $string = <<getCssClass()) + { + $string = << + + + Application Log + + +   + CategoryMessageTime Spent (s)Cumulated Time Spent (s) + +EOD; + } + else + { + $string = << @@ -673,18 +711,36 @@ class TBrowserLogRoute extends TLogRoute CategoryMessageTime Spent (s)Cumulated Time Spent (s) EOD; + } return $string; } protected function renderMessage($log, $info) { - $bgcolor = $info['even'] ? "#fff" : "#eee"; + $string = ''; $total = sprintf('%0.6f', $info['total']); $delta = sprintf('%0.6f', $info['delta']); - $color = $this->getColorLevel($log[1]); $msg = preg_replace('/\(line[^\)]+\)$/','',$log[0]); //remove line number info $msg = THttpUtility::htmlEncode($msg); - $string = <<getCssClass()) + { + $colorCssClass = $log[1]; + $messageCssClass = $info['even'] ? 'even' : 'odd'; + $string = << +   + {$log[2]} + {$msg} + {$delta} + {$total} + +EOD; + } + else + { + $bgcolor = $info['even'] ? "#fff" : "#eee"; + $color = $this->getColorLevel($log[1]); + $string = <<   {$log[2]} @@ -693,6 +749,7 @@ EOD; {$total} EOD; + } return $string; } @@ -713,13 +770,25 @@ EOD; protected function renderFooter() { - $string = ""; - foreach(self::$_levelValues as $name => $level) + $string = ''; + if($this->getCssClass()) { - $string .= "getColorLevel($level); - $string .= ";margin: 0.5em; padding:0.01em;\">".strtoupper($name).""; + $string .= ''; + foreach(self::$_levelValues as $name => $level) + { + $string .= ''.strtoupper($name).""; + } + } + else + { + $string .= ""; + foreach(self::$_levelValues as $name => $level) + { + $string .= "getColorLevel($level); + $string .= ";margin: 0.5em; padding:0.01em;\">".strtoupper($name).""; + } } - $string .= ""; + $string .= ''; return $string; } } -- cgit v1.2.3