PHP Class RedBeanPHP\Logger\RDefault\Debug

A special logger for debugging purposes. Provides debugging logging functions for RedBeanPHP.
Author: Gabor de Mooij and the RedBeanPHP Community
Inheritance: extends RedBeanPHP\Logger\RDefault, implements RedBeanPHP\Logger
Show file Open project: gabordemooij/redbean Class Usage Examples

Public Methods

Method Description
log ( ) : void Logger method.
setParamStringLength ( integer $len = 20 ) : self Sets the max string length for the parameter output in SQL queries. Set this value to a reasonable number to keep you SQL queries readable.

Protected Methods

Method Description
fillInValue ( mixed $value ) : string Fills in a value of a binding and truncates the resulting string if necessary.
normalizeBindings ( array $bindings ) : array Normalizes the bindings.
normalizeSlots ( string $sql ) : string Normalizes the slots in an SQL string.
output ( string $str ) : void Dependending on the current mode of operation, this method will either log and output to STDIN or just log.

Private Methods

Method Description
writeQuery ( string $newSql, $newBindings ) : string Writes a query for logging with all bindings / params filled in.

Method Details

fillInValue() protected method

Fills in a value of a binding and truncates the resulting string if necessary.
protected fillInValue ( mixed $value ) : string
$value mixed bound value
return string

log() public method

Takes a number of arguments tries to create a proper debug log based on the available data.
public log ( ) : void
return void

normalizeBindings() protected method

Replaces numeric binding keys with :slot1 :slot2 etc.
protected normalizeBindings ( array $bindings ) : array
$bindings array bindings to normalize
return array

normalizeSlots() protected method

Replaces question mark slots with :slot1 :slot2 etc.
protected normalizeSlots ( string $sql ) : string
$sql string sql to normalize
return string

output() protected method

Depending on the value of constant PHP_SAPI this function will format output for console or HTML.
protected output ( string $str ) : void
$str string string to log or output and log
return void

setParamStringLength() public method

Sets the max string length for the parameter output in SQL queries. Set this value to a reasonable number to keep you SQL queries readable.
public setParamStringLength ( integer $len = 20 ) : self
$len integer string length
return self