log.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!-- start log messages -->
  2. <table class="yiiLog" width="100%" cellpadding="2" style="border-spacing:1px;font:11px Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;color:#666666;">
  3. <tr>
  4. <th style="background:black;color:white;" colspan="5">
  5. Lietojumprogrammas žurnāls
  6. </th>
  7. </tr>
  8. <tr style="background-color: #ccc;">
  9. <th style="width:120px">Laiks</th>
  10. <th>Līmenis</th>
  11. <th>Kategorija</th>
  12. <th>Ziņojums</th>
  13. </tr>
  14. <?php
  15. $colors=array(
  16. CLogger::LEVEL_PROFILE=>'#DFFFE0',
  17. CLogger::LEVEL_INFO=>'#FFFFDF',
  18. CLogger::LEVEL_WARNING=>'#FFDFE5',
  19. CLogger::LEVEL_ERROR=>'#FFC0CB',
  20. );
  21. foreach($data as $index=>$log)
  22. {
  23. $color=($index%2)?'#F5F5F5':'#FFFFFF';
  24. if(isset($colors[$log[1]]))
  25. $color=$colors[$log[1]];
  26. $message='<pre>'.CHtml::encode(wordwrap($log[0])).'</pre>';
  27. $time=date('H:i:s.',$log[3]).sprintf('%06d',(int)(($log[3]-(int)$log[3])*1000000));
  28. echo <<<EOD
  29. <tr style="background:{$color}">
  30. <td align="center">{$time}</td>
  31. <td>{$log[1]}</td>
  32. <td>{$log[2]}</td>
  33. <td>{$message}</td>
  34. </tr>
  35. EOD;
  36. }
  37. ?>
  38. </table>
  39. <!-- end of log messages -->