Overview

Namespaces

  • Sleepy
  • Module
    • Authentication
    • CSV
    • DB
    • FormBuilder
    • FSDB
    • IP2Country
    • Mailer
    • MobiDetect
    • Navigation
    • StaticCache
  • PHP

Classes

  • Debug
  • Hook
  • Router
  • SM
  • Template

Exceptions

  • RouteNotFound
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Class Debug

Provides custom debugging functions.

This class can send emails, log to a database, or display on screen debug information. You can set the enabled flags to enable the debug functions or set them to false to quiet them down. This way you can leave them as a part of your code with little overhead. For email and database logging, don't forget to setup the public properties.

Usage

// Turn debugging to screen on
  Debug::$enable_show = true;
  Debug::out("This will goto the screen because $enable_show == true");

  // Turn off debugging to screen
  Debug::$enable_show = false;

Changelog

Version 1.9

  • Updated private suffix (_) and documentation for consistency

Version 1.8

  • Added namespacing

Version 1.7

  • Added the date section to the documentation
Namespace: Sleepy
License: http://opensource.org/licenses/MIT
Author: Jaime A. Rodriguez hi.i.am.jaime@gmail.com
Version: 1.9
Date: July 18, 2016
Located at class.debug.php
Methods summary
private
# __clone( )

Prevent class from being cloned

Prevent class from being cloned

Private

private
# __construct( )

The constructor is private to ensure we only have one instance

The constructor is private to ensure we only have one instance

Private

public
# __destruct( )

Send the email when the page is unloaded

Send the email when the page is unloaded

private static Sleepy\Debug
# _initialize( )

Return instance or create initial instance

Return instance or create initial instance

Returns

Sleepy\Debug

Private

public
# setHandler( )

sets the Exception Handler

sets the Exception Handler

public
# exceptionHandler( $e )

Exception Handler

Exception Handler

private boolean
# log( mixed $var )

Writes to a database log table. The table should be called log, or set $this->dbTable. It should contain 2 columns: 'datetime, message'

Writes to a database log table. The table should be called log, or set $this->dbTable. It should contain 2 columns: 'datetime, message'

Parameters

$var
Anything you want to log

Returns

boolean

Todo

add a create for the log table

Private

private static boolean
# show( mixed $var )

Displays debug information on screen

Displays debug information on screen

Parameters

$var
Anything you want to log

Returns

boolean

Todo

create a hook so the dev can create custom views when outputting debug data.


Private

private static boolean
# send( mixed $var )

Iterates a buffer that gets emailed on __destruct()

Iterates a buffer that gets emailed on __destruct()

Parameters

$var
Anything you want to log

Returns

boolean

Private

public static
# out( mixed $var )

Determines what output methods are enabled and passes $var to it.

Determines what output methods are enabled and passes $var to it.

Parameters

$var
Anything you want to log
public static
# disable( )

Sets all the enabled flags to false

Sets all the enabled flags to false

public static boolean
# sendEmail( )

Sends the email.

Sends the email.

Returns

boolean
true if sent successfully

Todo

make this private, I cannot remember why this is public...
Properties summary
private static Sleepy\Debug $_instance

The single instance is stored here.

The single instance is stored here.

Private

# NULL
private static PDO $_dbPDO

PDO Database object

PDO Database object

Private

#
public static boolean $enable_show

Enable output to screen

Enable output to screen

# false
public static boolean $enable_log

Enabled logging to a database

Enabled logging to a database

# false
public static boolean $enable_send

Enabled logging via email

Enabled logging via email

# false
public static string $emailTo

Email address to send email to.

Email address to send email to.

#
public static string $emailCC

Email address cc send email to.

Email address cc send email to.

#
public static string $emailBCC

Email address bcc send email to.

Email address bcc send email to.

#
public static string $emailFrom

Email address to send email from.

Email address to send email from.

#
public static string $emailSubject

The subject of the email.

The subject of the email.

#
public static string[] $emailBuffer

The body of the email.

The body of the email.

#
public static string $dbHost

Database Host

Database Host

#
public static string $dbName

Database Name

Database Name

#
public static string $dbUser

Database User Name

Database User Name

#
public static string $dbPass

Database Password

Database Password

#
public static string $dbTable

Database Table to use for logging

Database Table to use for logging

#
sleepyMUSTACHE v.0.8 API documentation generated by ApiGen