Updating repo for cross-computer work

This commit is contained in:
Torsten 2020-01-17 09:32:06 +01:00
parent 807cf49bc0
commit 1fea0f4fe7
18 changed files with 87847 additions and 5202 deletions

View file

@ -0,0 +1,44 @@
<?php
namespace App\MyClasses;
/* USAGE IN CLASS
--START OF FILE
use App\MyClasses\TimeLogger;
--START OF METHOD
$a=new TimeLogger("method XXX start");
Log::info($a->getStartMessage());
--END OF METHOD
Log::info($a->getEndMessage());
*/
class TimeLogger
{
public $startTime;
public $pkey;
public $functionName;
public function __construct($_functionName) {
$this->startTime = microtime(true);
$this->functionName =$_functionName;
$this->pkey="".rand(1000,9999);
}
public function getStartMessage() {
return "[CLOCK] [".$this->pkey."-".$this->functionName."] [started]";
}
public function getEndMessage() {
$time= ( microtime(true) - $this->startTime);
$timestr=number_format( $time, 4);
$retval="[CLOCK] [".$this->pkey."-". $this->functionName."] [ended] [elapsed: ".$timestr."]";
if ($time > 1.5) {
$retval=$retval." [PERFORMANCE_WARNING]";
}
return $retval;
}
}