Start of timelogging with own TimeLogger class
This commit is contained in:
parent
8a69e45efa
commit
78a4a04cdf
1 changed files with 23 additions and 0 deletions
23
pfosten/app/MyClasses/TimeLogger.php
Normal file
23
pfosten/app/MyClasses/TimeLogger.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
namespace App\MyClasses;
|
||||
|
||||
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() {
|
||||
return "[CLOCK] [".$this->pkey."-". $this->functionName."] [ended] [elapsed: ".number_format( ( microtime(true) - $this->startTime), 4)."]";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue