Provides easy and abstracted logging facilities

package BackPress

 Methods

Initialises the logging

BP_log($level = false, $type = false, $filename = false) : void

Parameters

$level

$type

$filename

_esc_js_log()

_esc_js_log($message) 

Parameters

$message

Outputs javascript functions for the head of the html document

console_javascript() : void

Must be included in the head of the debug document somehow when using 'console' type.

Send a debug message

debug($message, $prefix = false) : boolean

Parameters

$message

$prefix

Returns

booleanTrue on success, false on failure

Send an error message

error($message) : boolean

If the message is an array, then it sends each index as a separate message

Parameters

$message

Returns

booleanTrue on success, false on failure

Send an error message and die

fail($message) : boolean

If the message is an array, then it sends each index as a separate message

Parameters

$message

Returns

booleanTrue on success, false on failure

Formats a message for output to a log file

format_message($message, $level = BP_LOG_DEBUG, $prefix = false, $tabs = 0) : boolean

Parameters

$message

$level

$prefix

$tabs

Returns

booleanTrue on success, false on failure

Gets the name of the log level from an integer

get_level_from_integer($integer) : string

Parameters

$integer

Returns

stringThe logging level

Send a notice message

notice($message) : boolean

If the message is an array, then it sends each index as a separate message

Parameters

$message

Returns

booleanTrue on success, false on failure

Sends a message to the log

send($message = '', $level = BP_LOG_DEBUG, $type = false, $prefix = false) : boolean

Parameters

$message

$level

$type

$prefix

Returns

booleanTrue on success, false on failure

Sets the logging filename

set_filename($filename) : string | boolean
uses

Parameters

$filename

Returns

stringbooleanThe old filename on success or false

Sets the logging level

set_level($level) : integer | boolean
uses

Parameters

$level

Returns

integerbooleanThe old level on success or false

Sets the logging type

set_type($type) : string | false
uses

Parameters

$type

Returns

stringfalseThe old type on success or false

Send a warning message

warning($message) : boolean

If the message is an array, then it sends each index as a separate message

Parameters

$message

Returns

booleanTrue on success, false on failure

 Properties

 

Whether or not the javascript functions are available

$console_javascript_loaded : boolean

Default

false
 

Console log messages which are queued up to be displayed on page load

$console_javascript_onloads : array

Default

array()
 

The filename of the file to log messages to when type is "file"

$filename : string

Default

''
 

The logging level

$level : integer

Default

BP_LOG_NONE
 

The type of logging

$type : string

Default

'php'
 

The types of logging available

$types : array

Default

array('php', 'file', 'display', 'console')