Permalink
Browse files

enhanced log display.

  • Loading branch information...
qiang.xue
qiang.xue committed Mar 6, 2010
1 parent a332091 commit adc0f0dd346d7270189018f28a5c646ad0054495
Showing with 251 additions and 116 deletions.
  1. +18 −20 framework/YiiBase.php
  2. +9 −1 framework/views/bg/log.php
  3. +1 −1 framework/views/bg/profile-callstack.php
  4. +1 −1 framework/views/bg/profile-summary.php
  5. +10 −2 framework/views/de/log.php
  6. +1 −1 framework/views/de/profile-callstack.php
  7. +1 −1 framework/views/de/profile-summary.php
  8. +9 −1 framework/views/es/log.php
  9. +1 −1 framework/views/es/profile-callstack.php
  10. +1 −1 framework/views/es/profile-summary.php
  11. +39 −31 framework/views/fr/log.php
  12. +1 −1 framework/views/fr/profile-callstack.php
  13. +1 −1 framework/views/fr/profile-summary.php
  14. +10 −2 framework/views/he/log.php
  15. +1 −1 framework/views/he/profile-callstack.php
  16. +1 −1 framework/views/he/profile-summary.php
  17. +10 −2 framework/views/id/log.php
  18. +1 −1 framework/views/id/profile-callstack.php
  19. +1 −1 framework/views/id/profile-summary.php
  20. +9 −1 framework/views/it/log.php
  21. +1 −1 framework/views/it/profile-callstack.php
  22. +1 −1 framework/views/it/profile-summary.php
  23. +10 −2 framework/views/ja/log.php
  24. +1 −1 framework/views/ja/profile-callstack.php
  25. +1 −1 framework/views/ja/profile-summary.php
  26. +9 −1 framework/views/log.php
  27. +13 −4 framework/views/nl/log.php
  28. +1 −1 framework/views/nl/profile-callstack.php
  29. +1 −1 framework/views/nl/profile-summary.php
  30. +10 −2 framework/views/no/log.php
  31. +1 −1 framework/views/no/profile-callstack.php
  32. +1 −1 framework/views/no/profile-summary.php
  33. +1 −1 framework/views/profile-callstack.php
  34. +1 −1 framework/views/profile-summary.php
  35. +10 −2 framework/views/pt/log.php
  36. +1 −1 framework/views/pt/profile-callstack.php
  37. +1 −1 framework/views/pt/profile-summary.php
  38. +10 −2 framework/views/ro/log.php
  39. +1 −1 framework/views/ro/profile-callstack.php
  40. +1 −1 framework/views/ro/profile-summary.php
  41. +9 −1 framework/views/ru/log.php
  42. +1 −1 framework/views/ru/profile-callstack.php
  43. +1 −1 framework/views/ru/profile-summary.php
  44. +10 −2 framework/views/sv/log.php
  45. +1 −1 framework/views/sv/profile-callstack.php
  46. +1 −1 framework/views/sv/profile-summary.php
  47. +11 −3 framework/views/zh_cn/log.php
  48. +1 −1 framework/views/zh_cn/profile-callstack.php
  49. +1 −1 framework/views/zh_cn/profile-summary.php
  50. +11 −3 framework/views/zh_tw/log.php
  51. +1 −1 framework/views/zh_tw/profile-callstack.php
  52. +1 −1 framework/views/zh_tw/profile-summary.php
View
@@ -351,27 +351,7 @@ public static function autoload($className)
public static function trace($msg,$category='application')
{
if(YII_DEBUG)
- {
- if(YII_TRACE_LEVEL>0)
- {
- $traces=debug_backtrace();
- $count=0;
- foreach($traces as $trace)
- {
- if(isset($trace['file'],$trace['line']))
- {
- $className=substr(basename($trace['file']),0,-4);
- if(!isset(self::$_coreClasses[$className]) && $className!=='YiiBase')
- {
- $msg.="\nin ".$trace['file'].' ('.$trace['line'].')';
- if(++$count>=YII_TRACE_LEVEL)
- break;
- }
- }
- }
- }
self::log($msg,CLogger::LEVEL_TRACE,$category);
- }
}
/**
@@ -387,6 +367,24 @@ public static function log($msg,$level=CLogger::LEVEL_INFO,$category='applicatio
{
if(self::$_logger===null)
self::$_logger=new CLogger;
+ if(YII_DEBUG && YII_TRACE_LEVEL>0)
+ {
+ $traces=debug_backtrace();
+ $count=0;
+ foreach($traces as $trace)
+ {
+ if(isset($trace['file'],$trace['line']))
+ {
+ $className=substr(basename($trace['file']),0,-4);
+ if(!isset(self::$_coreClasses[$className]) && $className!=='YiiBase')
+ {
+ $msg.="\nin ".$trace['file'].' ('.$trace['line'].')';
+ if(++$count>=YII_TRACE_LEVEL)
+ break;
+ }
+ }
+ }
+ }
self::$_logger->log($msg,$level,$category);
}
View
@@ -12,9 +12,17 @@
<th>Съобщение</th>
</tr>
<?php
+$colors=array(
+ CLogger::LEVEL_PROFILE=>'#DFFFE0',
+ CLogger::LEVEL_INFO=>'#FFFFDF',
+ CLogger::LEVEL_WARNING=>'#FFDFE5',
+ CLogger::LEVEL_ERROR=>'#FFC0CB',
+);
foreach($data as $index=>$log)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
+ if(isset($colors[$log[1]]))
+ $color=$colors[$log[1]];
$message='<pre>'.CHtml::encode(wordwrap($log[0])).'</pre>';
$time=date('H:i:s.',$log[3]).(int)(($log[3]-(int)$log[3])*1000000);
@@ -12,7 +12,7 @@
<?php
foreach($data as $index=>$entry)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
list($proc,$time,$level)=$entry;
$proc=CHtml::encode($proc);
$time=sprintf('%0.5f',$time);
@@ -18,7 +18,7 @@
<?php
foreach($data as $index=>$entry)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
$proc=CHtml::encode($entry[0]);
$min=sprintf('%0.5f',$entry[2]);
$max=sprintf('%0.5f',$entry[3]);
View
@@ -12,10 +12,18 @@
<th>Nachricht</th>
</tr>
<?php
+$colors=array(
+ CLogger::LEVEL_PROFILE=>'#DFFFE0',
+ CLogger::LEVEL_INFO=>'#FFFFDF',
+ CLogger::LEVEL_WARNING=>'#FFDFE5',
+ CLogger::LEVEL_ERROR=>'#FFC0CB',
+);
foreach($data as $index=>$log)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
- $message=CHtml::encode($log[0]);
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
+ if(isset($colors[$log[1]]))
+ $color=$colors[$log[1]];
+ $message='<pre>'.CHtml::encode(wordwrap($log[0])).'</pre>';
$time=date('H:i:s.',$log[3]).(int)(($log[3]-(int)$log[3])*1000000);
echo <<<EOD
@@ -12,7 +12,7 @@
<?php
foreach($data as $index=>$entry)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
list($proc,$time,$level)=$entry;
$proc=CHtml::encode($proc);
$time=sprintf('%0.5f',$time);
@@ -18,7 +18,7 @@
<?php
foreach($data as $index=>$entry)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
$proc=CHtml::encode($entry[0]);
$min=sprintf('%0.5f',$entry[2]);
$max=sprintf('%0.5f',$entry[3]);
View
@@ -12,9 +12,17 @@
<th>Message</th>
</tr>
<?php
+$colors=array(
+ CLogger::LEVEL_PROFILE=>'#DFFFE0',
+ CLogger::LEVEL_INFO=>'#FFFFDF',
+ CLogger::LEVEL_WARNING=>'#FFDFE5',
+ CLogger::LEVEL_ERROR=>'#FFC0CB',
+);
foreach($data as $index=>$log)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
+ if(isset($colors[$log[1]]))
+ $color=$colors[$log[1]];
$message='<pre>'.CHtml::encode(wordwrap($log[0])).'</pre>';
$time=date('H:i:s.',$log[3]).(int)(($log[3]-(int)$log[3])*1000000);
@@ -12,7 +12,7 @@
<?php
foreach($data as $index=>$entry)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
list($proc,$time,$level)=$entry;
$proc=CHtml::encode($proc);
$time=sprintf('%0.5f',$time);
@@ -18,7 +18,7 @@
<?php
foreach($data as $index=>$entry)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
$proc=CHtml::encode($entry[0]);
$min=sprintf('%0.5f',$entry[2]);
$max=sprintf('%0.5f',$entry[3]);
View
@@ -1,32 +1,40 @@
-<!-- start log messages -->
-<table class="yiiLog" width="100%" cellpadding="2" style="border-spacing:1px;font:11px Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;color:#666666;">
- <tr>
- <th style="background:black;color:white;" colspan="5">
- Journal d'application
- </th>
- </tr>
- <tr style="background-color: #ccc;">
- <th style="width:120px">Heure</th>
- <th>Niveau</th>
- <th>Categorie</th>
- <th>Message</th>
- </tr>
-<?php
-foreach($data as $index=>$log)
-{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
- $message=CHtml::encode($log[0]);
- $time=date('H:i:s.',$log[3]).(int)(($log[3]-(int)$log[3])*1000000);
-
- echo <<<EOD
- <tr style="background:{$color}">
- <td align="center">{$time}</td>
- <td>{$log[1]}</td>
- <td>{$log[2]}</td>
- <td>{$message}</td>
- </tr>
-EOD;
-}
-?>
-</table>
+<!-- start log messages -->
+<table class="yiiLog" width="100%" cellpadding="2" style="border-spacing:1px;font:11px Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;color:#666666;">
+ <tr>
+ <th style="background:black;color:white;" colspan="5">
+ Journal d'application
+ </th>
+ </tr>
+ <tr style="background-color: #ccc;">
+ <th style="width:120px">Heure</th>
+ <th>Niveau</th>
+ <th>Categorie</th>
+ <th>Message</th>
+ </tr>
+<?php
+$colors=array(
+ CLogger::LEVEL_PROFILE=>'#DFFFE0',
+ CLogger::LEVEL_INFO=>'#FFFFDF',
+ CLogger::LEVEL_WARNING=>'#FFDFE5',
+ CLogger::LEVEL_ERROR=>'#FFC0CB',
+);
+foreach($data as $index=>$log)
+{
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
+ if(isset($colors[$log[1]]))
+ $color=$colors[$log[1]];
+ $message='<pre>'.CHtml::encode(wordwrap($log[0])).'</pre>';
+ $time=date('H:i:s.',$log[3]).(int)(($log[3]-(int)$log[3])*1000000);
+
+ echo <<<EOD
+ <tr style="background:{$color}">
+ <td align="center">{$time}</td>
+ <td>{$log[1]}</td>
+ <td>{$log[2]}</td>
+ <td>{$message}</td>
+ </tr>
+EOD;
+}
+?>
+</table>
<!-- end of log messages -->
@@ -12,7 +12,7 @@
<?php
foreach($data as $index=>$entry)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
list($proc,$time,$level)=$entry;
$proc=CHtml::encode($proc);
$time=sprintf('%0.5f',$time);
@@ -18,7 +18,7 @@
<?php
foreach($data as $index=>$entry)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
$proc=CHtml::encode($entry[0]);
$min=sprintf('%0.5f',$entry[2]);
$max=sprintf('%0.5f',$entry[3]);
View
@@ -12,10 +12,18 @@
<th>הודעה</th>
</tr>
<?php
+$colors=array(
+ CLogger::LEVEL_PROFILE=>'#DFFFE0',
+ CLogger::LEVEL_INFO=>'#FFFFDF',
+ CLogger::LEVEL_WARNING=>'#FFDFE5',
+ CLogger::LEVEL_ERROR=>'#FFC0CB',
+);
foreach($data as $index=>$log)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
- $message=CHtml::encode($log[0]);
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
+ if(isset($colors[$log[1]]))
+ $color=$colors[$log[1]];
+ $message='<pre>'.CHtml::encode(wordwrap($log[0])).'</pre>';
$time=date('H:i:s.',$log[3]).(int)(($log[3]-(int)$log[3])*1000000);
echo <<<EOD
@@ -12,7 +12,7 @@
<?php
foreach($data as $index=>$entry)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
list($proc,$time,$level)=$entry;
$proc=CHtml::encode($proc);
$time=sprintf('%0.5f',$time);
@@ -18,7 +18,7 @@
<?php
foreach($data as $index=>$entry)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
$proc=CHtml::encode($entry[0]);
$min=sprintf('%0.5f',$entry[2]);
$max=sprintf('%0.5f',$entry[3]);
View
@@ -12,10 +12,18 @@
<th>Pesan</th>
</tr>
<?php
+$colors=array(
+ CLogger::LEVEL_PROFILE=>'#DFFFE0',
+ CLogger::LEVEL_INFO=>'#FFFFDF',
+ CLogger::LEVEL_WARNING=>'#FFDFE5',
+ CLogger::LEVEL_ERROR=>'#FFC0CB',
+);
foreach($data as $index=>$log)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
- $message=CHtml::encode($log[0]);
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
+ if(isset($colors[$log[1]]))
+ $color=$colors[$log[1]];
+ $message='<pre>'.CHtml::encode(wordwrap($log[0])).'</pre>';
$time=date('H:i:s.',$log[3]).(int)(($log[3]-(int)$log[3])*1000000);
echo <<<EOD
@@ -12,7 +12,7 @@
<?php
foreach($data as $index=>$entry)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
list($proc,$time,$level)=$entry;
$proc=CHtml::encode($proc);
$time=sprintf('%0.5f',$time);
@@ -18,7 +18,7 @@
<?php
foreach($data as $index=>$entry)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
$proc=CHtml::encode($entry[0]);
$min=sprintf('%0.5f',$entry[2]);
$max=sprintf('%0.5f',$entry[3]);
View
@@ -12,9 +12,17 @@
<th>Messaggio</th>
</tr>
<?php
+$colors=array(
+ CLogger::LEVEL_PROFILE=>'#DFFFE0',
+ CLogger::LEVEL_INFO=>'#FFFFDF',
+ CLogger::LEVEL_WARNING=>'#FFDFE5',
+ CLogger::LEVEL_ERROR=>'#FFC0CB',
+);
foreach($data as $index=>$log)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
+ if(isset($colors[$log[1]]))
+ $color=$colors[$log[1]];
$message='<pre>'.CHtml::encode(wordwrap($log[0])).'</pre>';
$time=date('H:i:s.',$log[3]).(int)(($log[3]-(int)$log[3])*1000000);
@@ -12,7 +12,7 @@
<?php
foreach($data as $index=>$entry)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
list($proc,$time,$level)=$entry;
$proc=CHtml::encode($proc);
$time=sprintf('%0.5f',$time);
@@ -18,7 +18,7 @@
<?php
foreach($data as $index=>$entry)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
$proc=CHtml::encode($entry[0]);
$min=sprintf('%0.5f',$entry[2]);
$max=sprintf('%0.5f',$entry[3]);
View
@@ -12,10 +12,18 @@
<th>メッセージ</th>
</tr>
<?php
+$colors=array(
+ CLogger::LEVEL_PROFILE=>'#DFFFE0',
+ CLogger::LEVEL_INFO=>'#FFFFDF',
+ CLogger::LEVEL_WARNING=>'#FFDFE5',
+ CLogger::LEVEL_ERROR=>'#FFC0CB',
+);
foreach($data as $index=>$log)
{
- $color=($index%2)?'#F5F5F5':'#EBF8FE';
- $message=CHtml::encode($log[0]);
+ $color=($index%2)?'#F5F5F5':'#FFFFFF';
+ if(isset($colors[$log[1]]))
+ $color=$colors[$log[1]];
+ $message='<pre>'.CHtml::encode(wordwrap($log[0])).'</pre>';
$time=date('H:i:s.',$log[3]).(int)(($log[3]-(int)$log[3])*1000000);
echo <<<EOD
Oops, something went wrong.

0 comments on commit adc0f0d

Please sign in to comment.