\Hazaar\Logger\Backend
FirePHP
Sends the given data to the FirePHP Firefox Extension.

The data can be displayed in the Firebug Console or in the “Server” request tab.

For more information see: http://www.firephp.org/

Tags

Copyright

Copyright © 2007-2009 Christoph Dorn

Author

Christoph Dorn

License

http://www.opensource.org/licenses/bsd-license.php

Package

FirePHPCore

Summary
Methods Properties Constants
fb
log
to
LOG
Constants
DUMP
DUMP
Dumps a variable to firebug's server panel
ERROR
ERROR
Firebug ERROR level

Logs a message to firebug console, displays an error icon before the message and colors the line yellow. Also increments the firebug error count.

EXCEPTION
EXCEPTION
Displays an exception in firebug console

Increments the firebug error count.

GROUP_END
GROUP_END
Ends a group in firebug console
GROUP_START
GROUP_START
Starts a group in firebug console
INFO
INFO
Firebug INFO level

Logs a message to firebug console and displays an info icon before the message.

LOG
LOG
Firebug LOG level

Logs a message to firebug console.

TABLE
TABLE
Displays an table in firebug console
TRACE
TRACE
Displays a stack trace in firebug console
VERSION
VERSION
FirePHP version
WARN
WARN
Firebug WARN level

Logs a message to firebug console, displays an warning icon before the message and colors the line turquoise.

Properties
$convertAssertionErrorsToExceptions
$convertAssertionErrorsToExceptions
Flag whether to convert PHP assertion errors to Exceptions
$enabled
$enabled
Flag to enable/disable logging
$inExceptionHandler
$inExceptionHandler
Flag whether we are logging from within the exception handler
Static
$instance
$instance
Singleton instance of FirePHP
$json_objectStack
$json_objectStack
Keep a list of objects as we descend into the array so we can detect recursion.
$logToInsightConsole
$logToInsightConsole
The insight console to log to if applicable
$messageIndex
$messageIndex
Wildfire protocol message index
$objectFilters
$objectFilters
Filters used to exclude object members when encoding
$objectStack
$objectStack
A stack of objects used to detect recursion during object encoding
$options
$options
Options for the library
$throwAssertionExceptions
$throwAssertionExceptions
Flag whether to throw PHP assertion errors that have been converted to Exceptions
$throwErrorExceptions
$throwErrorExceptions
Flag whether to throw PHP errors that have been converted to ErrorExceptions
Methods
__sleep()
__sleep() : array
When the object gets serialized only include specific object members.

Returns

array
_escapeTrace()
_escapeTrace($Trace) : array
Escape trace path for windows systems

Parameters

$Tracearray

No description

Returns

array
_escapeTraceFile()
_escapeTraceFile($File) : string
Escape file information of trace for windows systems

Parameters

$Filestring

No description

Returns

string
_standardizePath()
_standardizePath($Path) : string
Standardizes path for windows systems.

Parameters

$Pathstring

No description

Returns

string
assertionHandler()
assertionHandler($file, $line, $code)
FirePHP's assertion handler

Logs all assertions to your firebug console and then stops the script.

Parameters

$filestring

File source of assertion

$lineint

Line source of assertion

$codemixed

Assertion code

detectClientExtension()
detectClientExtension() : boolean
Check if FirePHP is installed on client

Returns

boolean
dump()
dump($Key, $Variable, $Options = Array ( ) ) : true
Dumps key and variable to firebug server panel

Tags

See

FirePHP::DUMP

Throws

Exception

Parameters

$Keystring

No description

$Variablemixed

No description

$Options

No description

Returns

\Hazaar\Logger\Backend\true
encodeObject()
encodeObject($Object, $ObjectDepth = 1, $ArrayDepth = 1, $MaxDepth = 1) : array
Encodes an object including members with

protected and private visibility

Parameters

$ObjectObject

The object to be encoded

$ObjectDepth

No description

$ArrayDepth

No description

$MaxDepth

No description

Returns

array

All members of the object

encodeTable()
encodeTable($Table) : array
Encodes a table by encoding each row and column with encodeObject()

Parameters

$Tablearray

The table to be encoded

Returns

array
error()
error($Object, $Label = null, $Options = Array ( ) ) : true
Log object with label to firebug console

Tags

See

FirePHP::ERROR

Throws

Exception

Parameters

$Object\Hazaar\Logger\Backend\mixes

No description

$Labelstring

No description

$Options

No description

Returns

\Hazaar\Logger\Backend\true
errorHandler()
errorHandler($errno, $errstr, $errfile, $errline, $errcontext)
FirePHP's error handler

Throws exception for each php error that will occur.

Parameters

$errnoint

No description

$errstrstring

No description

$errfilestring

No description

$errlineint

No description

$errcontextarray

No description

exceptionHandler()
exceptionHandler($Exception)
FirePHP's exception handler

Logs all exceptions to your firebug console and then stops the script.

Tags

Throws

Exception

Parameters

$Exception\Hazaar\Logger\Backend\Exception

No description

fb()
fb($Object) : true
Log varible to Firebug

Tags

See

http://www.firephp.org/Wiki/Reference/Fb

Throws

Exception

Parameters

$Objectmixed

The variable to be logged

Returns

\Hazaar\Logger\Backend\true

Return TRUE if message was added to headers, FALSE otherwise

Static
getAllRequestHeaders()
getAllRequestHeaders() : array
Get all request headers

Returns

array
getEnabled()
getEnabled() : boolean
Check if logging is enabled

Returns

boolean

TRUE if enabled

Static
getInstance()
getInstance($AutoCreate = false) : FirePHP
Gets singleton instance of FirePHP

Parameters

$AutoCreateboolean

No description

Returns

\Hazaar\Logger\Backend\FirePHP
getOption()
getOption($Name) : mixed
Get an option from the library

Tags

Throws

Exception

Parameters

$Namestring

No description

Returns

mixed
getOptions()
getOptions() : array
Get options from the library

Returns

array

The currently set options

getRequestHeader()
getRequestHeader($Name) : string|false
Get a request header

Parameters

$Name

No description

Returns

\Hazaar\Logger\Backend\string|false
getUserAgent()
getUserAgent() : string|false
Get user agent
group()
group($Name, $Options = null) : true
Start a group for following messages.

Options: Collapsed: [true|false] Color: 1

Tags

Throws

Exception

Parameters

$Namestring

No description

$Optionsarray

OPTIONAL Instructions on how to log the group

Returns

\Hazaar\Logger\Backend\true
groupEnd()
groupEnd() : true
Ends a group you have started before

Tags

Throws

Exception

headersSent()
headersSent($Filename, $Linenum)
Check if headers have already been sent

Parameters

$Filenamestring

No description

$Linenuminteger

No description

info()
info($Object, $Label = null, $Options = Array ( ) ) : true
Log object with label to firebug console

Tags

See

FirePHP::INFO

Throws

Exception

Parameters

$Object\Hazaar\Logger\Backend\mixes

No description

$Labelstring

No description

$Options

No description

Returns

\Hazaar\Logger\Backend\true
Static
init()
init() : FirePHP
Creates FirePHP object and stores it for singleton access
Static
is_utf8()
is_utf8($str) : boolean
Returns true if $string is valid UTF-8 and false otherwise.

Parameters

$strmixed

String to be tested

Returns

boolean
jsonEncode()
jsonEncode($Object, $skipObjectEncode = false) : string
Encode an object into a JSON string

Uses PHP’s jeson_encode() if available

Parameters

$Objectobject

The object to be encoded

$skipObjectEncode

No description

Returns

string

The JSON string

json_encode()
json_encode($var) : mixed
encodes an arbitrary variable into JSON format

Tags

Access

public

Parameters

$varmixed

any number, boolean, string, array, or object to be encoded. see argument 1 to Services_JSON() above for array-parsing behavior. if var is a strng, note that encode() always expects it to be in ASCII or UTF-8 format!

Returns

mixed

JSON string representation of input var or an error if a problem occurs

json_name_value()
json_name_value($name, $value) : string
array-walking function for use in generating JSON-formatted name-value pairs

Tags

Access

private

Parameters

$namestring

name of key to use

$valuemixed

reference to an array element to be encoded

Returns

string

JSON-formatted name-value pair, like ‘“name”:value’

json_utf82utf16()
json_utf82utf16($utf8) : string
convert a string from one UTF-8 char to one UTF-16 char

Normally should be handled by mb_convert_encoding, but provides a slower PHP-only method for installations that lack the multibye string extension.

Tags

Access

private

Parameters

$utf8string

UTF-8 character

Returns

string

UTF-16 character

log()
log($Object, $Label = null, $Options = Array ( ) ) : true
Log object with label to firebug console

Tags

See

FirePHP::LOG

Throws

Exception

Parameters

$Object\Hazaar\Logger\Backend\mixes

No description

$Labelstring

No description

$Options

No description

Returns

\Hazaar\Logger\Backend\true
newException()
newException($Message) : Exception
Returns a new \Exception

Parameters

$Messagestring

No description

Returns

\Hazaar\Logger\Backend\Exception
Static
plugin()
plugin()
Insight API wrapper

Tags

See

Insight_Helper::plugin()

registerAssertionHandler()
registerAssertionHandler($convertAssertionErrorsToExceptions = true, $throwAssertionExceptions = false) : mixed
Register FirePHP driver as your assert callback

Parameters

$convertAssertionErrorsToExceptionsboolean

No description

$throwAssertionExceptionsboolean

No description

Returns

mixed

Returns the original setting or FALSE on errors

registerErrorHandler()
registerErrorHandler($throwErrorExceptions = false) : mixed
Register FirePHP as your error handler

Will throw exceptions for each php error.

Parameters

$throwErrorExceptions

No description

Returns

mixed

Returns a string containing the previously defined error handler (if any)

registerExceptionHandler()
registerExceptionHandler() : mixed
Register FirePHP as your exception handler

Returns

mixed

Returns the name of the previously defined exception handler, or NULL on error. If no previous handler was defined, NULL is also returned.

setEnabled()
setEnabled($Enabled) : void
Enable and disable logging to Firebug

Parameters

$Enabledboolean

TRUE to enable, FALSE to disable

Returns

\Hazaar\Logger\Backend\void
setHeader()
setHeader($Name, $Value)
Send header

Parameters

$Namestring

No description

$Valuestring

No description

Static
setInstance()
setInstance($instance) : FirePHP
Set the instance of the FirePHP singleton

Parameters

$instance\Hazaar\Logger\Backend\FirePHP

The FirePHP object instance

Returns

\Hazaar\Logger\Backend\FirePHP
setLogToInsightConsole()
setLogToInsightConsole($console) : void
Set an Insight console to direct all logging calls to

Parameters

$consoleobject

The console object to log to

Returns

\Hazaar\Logger\Backend\void
setObjectFilter()
setObjectFilter($Class, $Filter) : void
Specify a filter to be used when encoding an object

Filters are used to exclude object members.

Parameters

$Classstring

The class name of the object

$Filterarray

An array of members to exclude

Returns

\Hazaar\Logger\Backend\void
setOption()
setOption($Name, $Value) : void
Set an option for the library

Tags

Throws

Exception

Parameters

$Namestring

No description

$Valuemixed

No description

Returns

\Hazaar\Logger\Backend\void
setOptions()
setOptions($Options) : void
Set some options for the library

Options: – maxDepth: The maximum depth to traverse (default: 10) – maxObjectDepth: The maximum depth to traverse objects (default: 5) – maxArrayDepth: The maximum depth to traverse arrays (default: 5) – useNativeJsonEncode: If true will use json_encode() (default: true) – includeLineNumbers: If true will include line numbers and filenames (default: true)

Parameters

$Optionsarray

The options to be set

Returns

\Hazaar\Logger\Backend\void
setProcessorUrl()
setProcessorUrl($URL)

Tags

Deprecated

Parameters

$URL

No description

setRendererUrl()
setRendererUrl($URL)

Tags

Deprecated

Parameters

$URL

No description

table()
table($Label, $Table, $Options = Array ( ) ) : true
Log a table in the firebug console

Tags

See

FirePHP::TABLE

Throws

Exception

Parameters

$Labelstring

No description

$Tablestring

No description

$Options

No description

Returns

\Hazaar\Logger\Backend\true
Static
to()
to()
Insight API wrapper

Tags

See

Insight_Helper::to()

trace()
trace($Label) : true
Log a trace in the firebug console

Tags

See

FirePHP::TRACE

Throws

Exception

Parameters

$Labelstring

No description

Returns

\Hazaar\Logger\Backend\true
warn()
warn($Object, $Label = null, $Options = Array ( ) ) : true
Log object with label to firebug console

Tags

See

FirePHP::WARN

Throws

Exception

Parameters

$Object\Hazaar\Logger\Backend\mixes

No description

$Labelstring

No description

$Options

No description

Returns

\Hazaar\Logger\Backend\true