Debug
class Debug (View source)
Supports debugging and core error handling.
Attaches custom methods to the default error handling hooks in PHP. Currently, two levels of error are supported:
- Notice
- Warning
- Error
Uncaught exceptions are currently passed to the debug reporter as standard PHP errors.
Errors handled by this class are passed along to {@link SS_Log}. For configuration information, see the {@link SS_Log} class documentation.
Properties
static private string | $log_errors_to | ||
static private string | $friendly_error_header | ||
static private bool | $friendly_error_httpcode | Set to true to enable friendly errors to set a http response code corresponding to the error. |
|
static private string | $friendly_error_detail |
Methods
Show the contents of val in a debug-friendly way.
Returns the caller for a specific method
Close out the show dumper
Quick dump of a variable.
??
Show a debugging message
Send a debug message in an HTTP header. Only works if you are on Dev, and headers have not yet been sent.
Log to a standard text file output.
Load error handlers into environment.
No description
Handle a non-fatal warning error thrown by PHP interpreter.
Handle a fatal error, depending on the mode of the site (ie: Dev, Test, or Live).
Render a user-facing error page, using the default HTML error template rendered by {@link ErrorPage} if it exists. Doesn't use the standard {@link SS_HTTPResponse} class the keep dependencies minimal.
Create an instance of an appropriate DebugView object.
Render a developer facing error page, showing the stack trace and details of the code where the error occured.
Utility method to render a snippet of PHP source code, from selected file and highlighting the given line number.
Check if the user has permissions to run URL debug tools, else redirect them to log in.
Details
static
show($val, $showHeader = true)
Show the contents of val in a debug-friendly way.
Debug::show() is intended to be equivalent to dprintr()
static array
caller()
Returns the caller for a specific method
static
endshow(mixed $val)
Close out the show dumper
static
dump(mixed $val)
Quick dump of a variable.
static unknown
text(unknown_type $val)
??
static
message($message, $showHeader = true)
Show a debugging message
static void
header(string $msg, string $prefix = null)
Send a debug message in an HTTP header. Only works if you are on Dev, and headers have not yet been sent.
static
log($message)
Log to a standard text file output.
static
loadErrorHandlers()
Load error handlers into environment.
Caution: The error levels default to E_ALL is the site is in dev-mode (set in main.php).
static
noticeHandler($errno, $errstr, $errfile, $errline, $errcontext)
static
warningHandler(unknown_type $errno, unknown_type $errstr, unknown_type $errfile, unknown_type $errline, unknown_type $errcontext)
Handle a non-fatal warning error thrown by PHP interpreter.
static
fatalHandler(unknown_type $errno, unknown_type $errstr, unknown_type $errfile, unknown_type $errline, unknown_type $errcontext)
Handle a fatal error, depending on the mode of the site (ie: Dev, Test, or Live).
Runtime execution dies immediately once the error is generated.
static string
friendlyError(int $statusCode = 500, string $friendlyErrorMessage = null, string $friendlyErrorDetail = null)
Render a user-facing error page, using the default HTML error template rendered by {@link ErrorPage} if it exists. Doesn't use the standard {@link SS_HTTPResponse} class the keep dependencies minimal.
static DebugView
create_debug_view()
Create an instance of an appropriate DebugView object.
static
showError(unknown_type $errno, unknown_type $errstr, unknown_type $errfile, unknown_type $errline, unknown_type $errcontext, $errtype)
Render a developer facing error page, showing the stack trace and details of the code where the error occured.
static
showLines(string $errfile, int $errline)
Utility method to render a snippet of PHP source code, from selected file and highlighting the given line number.
static
require_developer_login()
Check if the user has permissions to run URL debug tools, else redirect them to log in.