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; } }