Debugger
extends Singleton
in package
Magrathea Debugger can manage anything for debugging and error-searching through Magrathea Codes.
It can trace errors, save log files, print queries and do a bunch of functions that would help the developer on error searching
Table of Contents
Constants
Properties
- $instance : array<string|int, mixed>|null
- $debugItems : mixed
- $debugType : mixed
- $logFile : mixed
- $oldDebugType : mixed
- $queries : mixed
Methods
- __wakeup() : mixed
- Add() : mixed
- Add an item to the debug array object
- AddError() : mixed
- Adds an error to the debugger
- AddQuery() : mixed
- Adds a query to the debug
- BackTemp() : Debugger
- After temporarily setting a debugging type, gets it back to what it was
- Error() : mixed
- Adds an error to the debugger
- GetType() : string
- Returns the debug type
- GetTypeDesc() : string
- Returns the debug type in a descritive format
- Info() : mixed
- Add an info item to the debug array object
- Instance() : static|Singleton
- LogQueries() : Debugger
- Should debugger log queries?
- MockClass() : static|Singleton
- SetDebug() : Debugger
- Sets debug mode as debug
- SetDev() : Debugger
- Sets debug mode as dev
- SetInstance() : mixed
- SetLogFile() : Debugger
- Set the name of log file that will be used (it will be created inside "*logs*" folder)
- SetTemp() : Debugger
- Sets a debugger type temporarily (usefull when need to check a specific operation, for example)
- SetType() : Debugger
- Sets the debugger method It can be: *DEV*, *DEBUG*, *LOG*, *NONE* => **Debugger::DEV** = Will print the debugs as it appears in the code **Debugger::DEBUG** = Will store all the debugs and print it later **Debugger::LOG** = Will log queries and other debugs in the code **Debugger::NONE** = Well... nothing to do, heh? Default: **LOG**
- Show() : mixed
- Prints the debug
- Trace() : mixed
- Trace error location
- __clone() : mixed
- __construct() : mixed
- printsDebug() : mixed
- prints every single line in p_r()
- printTrace() : string
- gets a trace array and returns a beautiful way of it printed
Constants
DEBUG
public
mixed
DEBUG
= 3
DEV
public
mixed
DEV
= 4
LOG
public
mixed
LOG
= 2
NONE
public
mixed
NONE
= 0
Properties
$instance
protected
static array<string|int, mixed>|null
$instance
= []
$debugItems
private
mixed
$debugItems
= array()
$debugType
private
mixed
$debugType
= self::LOG
$logFile
private
mixed
$logFile
= null
$oldDebugType
private
mixed
$oldDebugType
= self::NONE
$queries
private
mixed
$queries
= false
Methods
__wakeup()
public
final __wakeup() : mixed
Add()
Add an item to the debug array object
public
Add(mixed $debug) : mixed
@param string $debug debug item
Parameters
- $debug : mixed
AddError()
Adds an error to the debugger
public
AddError(Exception $err) : mixed
Parameters
- $err : Exception
-
Exception
AddQuery()
Adds a query to the debug
public
AddQuery(string $sql, string $values) : mixed
Parameters
- $sql : string
-
query to be debugged
- $values : string
-
values to be added to the query
BackTemp()
After temporarily setting a debugging type, gets it back to what it was
public
BackTemp() : Debugger
Return values
DebuggerError()
Adds an error to the debugger
public
Error(Exception $err) : mixed
Parameters
- $err : Exception
-
Exception
GetType()
Returns the debug type
public
GetType() : string
Return values
string —Debug type (Dev, Debug, Log, None)
GetTypeDesc()
Returns the debug type in a descritive format
public
GetTypeDesc() : string
Return values
string —Debug type (Dev, Debug, Log, None)
Info()
Add an info item to the debug array object
public
Info(mixed $debug) : mixed
@param string $debug info item
Parameters
- $debug : mixed
Instance()
public
static Instance() : static|Singleton
Return values
static|SingletonLogQueries()
Should debugger log queries?
public
LogQueries(bool $q) : Debugger
Parameters
- $q : bool
-
true for logging queries, false for not
Return values
DebuggerMockClass()
public
static MockClass(mixed $mocker) : static|Singleton
Parameters
- $mocker : mixed
Return values
static|SingletonSetDebug()
Sets debug mode as debug
public
SetDebug() : Debugger
Return values
DebuggerSetDev()
Sets debug mode as dev
public
SetDev() : Debugger
Return values
DebuggerSetInstance()
public
SetInstance(mixed $inst) : mixed
Parameters
- $inst : mixed
SetLogFile()
Set the name of log file that will be used (it will be created inside "*logs*" folder)
public
SetLogFile(string $file) : Debugger
Parameters
- $file : string
-
log file name
Return values
DebuggerSetTemp()
Sets a debugger type temporarily (usefull when need to check a specific operation, for example)
public
SetTemp(string $dType) : Debugger
Parameters
- $dType : string
-
type to be temporarily set
Return values
DebuggerSetType()
Sets the debugger method It can be: *DEV*, *DEBUG*, *LOG*, *NONE* => **Debugger::DEV** = Will print the debugs as it appears in the code **Debugger::DEBUG** = Will store all the debugs and print it later **Debugger::LOG** = Will log queries and other debugs in the code **Debugger::NONE** = Well... nothing to do, heh? Default: **LOG**
public
SetType( $type) : Debugger
Parameters
Return values
DebuggerShow()
Prints the debug
public
Show() : mixed
Trace()
Trace error location
public
Trace() : mixed
__clone()
protected
final __clone() : mixed
__construct()
private
final __construct() : mixed
printsDebug()
prints every single line in p_r()
private
printsDebug(mixed $deb) : mixed
Parameters
- $deb : mixed
printTrace()
gets a trace array and returns a beautiful way of it printed
private
printTrace(array<string|int, mixed> $trace) : string
Parameters
- $trace : array<string|int, mixed>
-
trace
Return values
string —html of the trace printed