Improved backtracing
This commit is contained in:
parent
09141f3d10
commit
cdf3eae890
7 changed files with 192 additions and 90 deletions
|
@ -12,7 +12,7 @@
|
|||
* @var string|null
|
||||
* @property_name function
|
||||
*/
|
||||
public $Function;
|
||||
private $Function;
|
||||
|
||||
/**
|
||||
* The line number of the backtrace
|
||||
|
@ -20,7 +20,7 @@
|
|||
* @var int|null
|
||||
* @property_name line
|
||||
*/
|
||||
public $Line;
|
||||
private $Line;
|
||||
|
||||
/**
|
||||
* The file name of the backtrace
|
||||
|
@ -28,7 +28,7 @@
|
|||
* @var string|null
|
||||
* @property_name file
|
||||
*/
|
||||
public $File;
|
||||
private $File;
|
||||
|
||||
/**
|
||||
* The class name, if any, of the backtrace
|
||||
|
@ -36,7 +36,7 @@
|
|||
* @var string|null
|
||||
* @property_name class
|
||||
*/
|
||||
public $Class;
|
||||
private $Class;
|
||||
|
||||
/**
|
||||
* The current call type. If a method call, "->" is returned.
|
||||
|
@ -47,7 +47,7 @@
|
|||
* @var string|null
|
||||
* @property_name type
|
||||
*/
|
||||
public $Type;
|
||||
private $Type;
|
||||
|
||||
/**
|
||||
* If inside a function, this lists the functions arguments. If inside
|
||||
|
@ -56,5 +56,119 @@
|
|||
* @var array|null
|
||||
* @property_name args
|
||||
*/
|
||||
public $Args;
|
||||
private $Args;
|
||||
|
||||
/**
|
||||
* Public Constructor
|
||||
*
|
||||
* @param array|null $backtrace
|
||||
*/
|
||||
public function __construct(?array $backtrace=null)
|
||||
{
|
||||
if($backtrace === null)
|
||||
return;
|
||||
|
||||
$this->Function = $backtrace['function'] ?? null;
|
||||
$this->Line = $backtrace['line'] ?? null;
|
||||
$this->File = $backtrace['file'] ?? null;
|
||||
$this->Class = $backtrace['class'] ?? null;
|
||||
$this->Type = $backtrace['type'] ?? null;
|
||||
$this->Args = $backtrace['args'] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFunction(): ?string
|
||||
{
|
||||
return $this->Function;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $Function
|
||||
*/
|
||||
public function setFunction(?string $Function): void
|
||||
{
|
||||
$this->Function = $Function;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int|null
|
||||
*/
|
||||
public function getLine(): ?int
|
||||
{
|
||||
return $this->Line;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int|null $Line
|
||||
*/
|
||||
public function setLine(?int $Line): void
|
||||
{
|
||||
$this->Line = $Line;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFile(): ?string
|
||||
{
|
||||
return $this->File;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $File
|
||||
*/
|
||||
public function setFile(?string $File): void
|
||||
{
|
||||
$this->File = $File;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getClass(): ?string
|
||||
{
|
||||
return $this->Class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $Class
|
||||
*/
|
||||
public function setClass(?string $Class): void
|
||||
{
|
||||
$this->Class = $Class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getType(): ?string
|
||||
{
|
||||
return $this->Type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $Type
|
||||
*/
|
||||
public function setType(?string $Type): void
|
||||
{
|
||||
$this->Type = $Type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
public function getArgs(): ?array
|
||||
{
|
||||
return $this->Args;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $Args
|
||||
*/
|
||||
public function setArgs(?array $Args): void
|
||||
{
|
||||
$this->Args = $Args;
|
||||
}
|
||||
}
|
|
@ -7,7 +7,6 @@
|
|||
use LogLib\Abstracts\LevelType;
|
||||
use LogLib\Classes\Utilities;
|
||||
use Throwable;
|
||||
|
||||
class Event
|
||||
{
|
||||
/**
|
||||
|
@ -33,7 +32,7 @@
|
|||
* @var Backtrace[]|null
|
||||
* @property_name backtrace
|
||||
*/
|
||||
public $Backtrace;
|
||||
private $Backtrace;
|
||||
|
||||
/**
|
||||
* The exception that was thrown, if any
|
||||
|
@ -53,7 +52,7 @@
|
|||
|
||||
public function __construct()
|
||||
{
|
||||
$this->Timestamp = date('Y-m-dTH:i:s.v') . (date('p') == 'Z' ? 'Z' : 'L');
|
||||
$this->Timestamp = date('c');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,4 +74,20 @@
|
|||
return $this->Timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|null
|
||||
*/
|
||||
public function getBacktrace(): ?array
|
||||
{
|
||||
return $this->Backtrace;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $Backtrace
|
||||
*/
|
||||
public function setBacktrace(?array $Backtrace): void
|
||||
{
|
||||
$this->Backtrace = $Backtrace;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue