Permalink
Browse files

added check for log textColor in logging pannel

  • Loading branch information...
1 parent e65f496 commit 6f4c94ba1f6fb3a7d7af17278ca302715a0ccda0 Eugen Popescu committed May 13, 2014
Showing with 29 additions and 21 deletions.
  1. +29 −21 views/panels/logging.php
View
@@ -1,38 +1,46 @@
- <?php
-$colors=array(
- CLogger::LEVEL_PROFILE=>'#DFFFE0',
- CLogger::LEVEL_INFO=>'#FFFFDF',
- CLogger::LEVEL_WARNING=>'#FFDFE5',
- CLogger::LEVEL_ERROR=>'#FFC0CB',
+<?php /** @var array $logs */ ?>
+
+<?php $colors = array(
+ CLogger::LEVEL_PROFILE => '#DFFFE0',
+ CLogger::LEVEL_INFO => '#FFFFDF',
+ CLogger::LEVEL_WARNING => '#FFDFE5',
+ CLogger::LEVEL_ERROR => '#FFC0CB',
);
?>
<div data-ydtb-panel-data="<?php echo $this->id ?>">
<div>
<table data-ydtb-data-table>
<thead>
- <tr>
- <th><?php echo YiiDebug::t('Message (details)')?></th>
- <th><?php echo YiiDebug::t('Level')?></th>
- <th><?php echo YiiDebug::t('Category')?></th>
- <th><?php echo YiiDebug::t('Time')?></th>
- <th>Duration<br />
- <?php foreach($this->colorsDuration as $item) :?>
- <span style="background-color:<?php echo $item['backgroundColor']; ?>; width:9px; height:9px; display:block; float:left; margin:1px;"></span>
+ <tr>
+ <th><?php echo YiiDebug::t('Message (details)') ?></th>
+ <th><?php echo YiiDebug::t('Level') ?></th>
+ <th><?php echo YiiDebug::t('Category') ?></th>
+ <th><?php echo YiiDebug::t('Time') ?></th>
+ <th>Duration<br/>
+ <?php foreach ($this->colorsDuration as $item) : ?>
+ <span
+ style="background-color:<?php echo $item['backgroundColor']; ?>; width:9px; height:9px; display:block; float:left; margin:1px;"></span>
<?php endforeach; ?>
- </th>
- </tr>
+ </th>
+ </tr>
</thead>
<tbody>
- <?php $old=null; ?>
- <?php foreach($logs as $id=>$entry): ?>
- <?php $r=$this->diffTime($entry[3], $old); $old=$entry[3]; ?>
+ <?php $old = null; ?>
+ <?php foreach ($logs as $id => $entry): ?>
+ <?php $r = $this->diffTime($entry[3], $old);
+ $old = $entry[3]; ?>
<tr>
<td data-ydtb-data-type="varchar"><?php echo nl2br($entry[0]) ?></td>
<td data-ydtb-data-type="char"><?php echo $entry[1]; ?></td>
<td data-ydtb-data-type="char"><?php echo $entry[2] ?></td>
- <td data-ydtb-data-type="number"><?php echo date('H:i:s.',$entry[3]).sprintf('%06d',(int)(($entry[3]-(int)$entry[3])*1000000));?></td>
- <td style="color:<?php echo $r['textColor']; ?>; background-color:<?php echo $r['backgroundColor']; ?>;"><?php echo $r['duration']; ?></td>
+ <td data-ydtb-data-type="number">
+ <?php echo date('H:i:s.', $entry[3]) .
+ sprintf('%06d', (int)(($entry[3] - (int)$entry[3]) * 1000000)); ?></td>
+ <td style="color:<?php echo isset($r['textColor']) ? $r['textColor'] : CLogger::LEVEL_ERROR; ?>;
+ background-color:<?php echo isset($r['backgroundColor']) ? $r['backgroundColor'] : CLogger::LEVEL_WARNING; ?>;">
+ <?php echo $r['duration']; ?>
+ </td>
</tr>
<?php endforeach; ?>
</tbody>

0 comments on commit 6f4c94b

Please sign in to comment.