From b61d452511224338bb3cce5fcd62ce9b2462775c Mon Sep 17 00:00:00 2001 From: Axel Hahn <axel.hahn@iml.unibe.ch> Date: Thu, 18 Dec 2014 15:52:35 +0100 Subject: [PATCH] - added: skip dereferenced tags in git (tags ending ^{} ) - added: modal infobox in build page if you switch the branch - added: git uses a cache for taglist and revision infos (ttl is 5 min) - added client dubugging (axels ip) - reactivated: menu project->actipons->cleanup to delete the cache - changed: cut commit message a bit: do not show * [new branch] --- .../deployment/classes/logger.class.php | 49 ++++++++++++++++--- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/public_html/deployment/classes/logger.class.php b/public_html/deployment/classes/logger.class.php index 1bc74090..691c92f6 100644 --- a/public_html/deployment/classes/logger.class.php +++ b/public_html/deployment/classes/logger.class.php @@ -29,6 +29,11 @@ class logger { return $this->bShowDebug=$bEnable; } + /** + * enable client debugging by a given array of allowed ip addresses + * @param type $aIpArray + * @return boolean + */ public function enableDebugByIp($aIpArray){ $this->enableDebug(false); if (!$_SERVER || !is_array($_SERVER) || !array_key_exists("REMOTE_ADDR", $_SERVER)){ @@ -71,18 +76,49 @@ class logger { } $sOut=''; $sStarttime=$this->aMessages[0]["time"]; + + $iCounter=0; + $sMaxRowId=false; + $iMaxtime=-1; + $sWarnings=false; + $iLasttime=$sStarttime; + foreach ($this->aMessages as $aLogentry){ - $sOut.='<tr class="'.$aLogentry["level"].'">'. - '<!-- <td>'.$aLogentry["time"].'</td> -->'. - '<td>'.sprintf("%01.4f", $aLogentry["time"]-$sStarttime).'</td>'. - '<td>'.sprintf("%01.4f", $aLogentry["time"]-$iLasttime).'</td>'. + $iCounter++; + $sTrId='debugTableRow'.$iCounter; + $iDelta=$aLogentry["time"]-$iLasttime; + if ($iDelta > $iMaxtime){ + $iMaxtime=$iDelta; + $sMaxRowId=$sTrId; + } + + + $sStyle=($iDelta > 1)?'color: #f82;':''; + if (($iDelta > 1)){ + $sWarnings.='<a href="#'.$sTrId.'" title="'.sprintf("%01.4f", $iDelta).' s">'.$iCounter.'</a> '; + } + $sOut.='<tr class="'.$aLogentry["level"].'" id="'.$sTrId.'" style="'.$sStyle.'">'. + '<td>'.$iCounter.'</td>'. + '<td>'.sprintf("%01.3f", $aLogentry["time"]-$sStarttime).'</td>'. + '<td>'.sprintf("%01.3f", $iDelta).'</td>'. '<td>'.$aLogentry["level"].'</td>'. '<td>'.$aLogentry["message"].'</td>'. '</tr>'; $iLasttime=$aLogentry["time"]; + } + $iTotal=$iLasttime-$sStarttime; + if ($sWarnings){ + $sWarnings='<br>warnings: '.$sWarnings; + } + if ($sOut) $sOut=' + <div style="position: fixed; right: 1em; top: 6em; background: rgba(255,80,80, 0.1); padding: 0.5em;"> + <span style="font-size: 130%;">total: '.sprintf("%01.3f", $iTotal).' s</span><br> + <span>longest action: <a href="#'.$sMaxRowId.'">'.sprintf("%01.3f", $iMaxtime).' s</a></span> + <span>'.$sWarnings.'</span> + </div> <br> <br> <br> @@ -92,13 +128,14 @@ class logger { <table class="datatable table table-striped debugtable"> <thead> <tr> - <!-- <th>time</th> --> + <th>#</th> <th>delta to start time</th> <th>delta to previuos</th> <th>level</th> <th>message</th> </tr></thead><tbody> - '.$sOut.'</tbody></table>'; + '.$sOut.'</tbody></table>' + . '<script>$(\'#'.$sMaxRowId.'\').css(\'color\', \'#f00\');</script>'; return $sOut; } } -- GitLab