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
Afficher le fichier Open project: gabordemooij/redbean Class Usage Examples

Méthodes publiques

Méthode 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.

Méthodes protégées

Méthode 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

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

Method Details

fillInValue() protected méthode

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

log() public méthode

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

normalizeBindings() protected méthode

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

normalizeSlots() protected méthode

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

output() protected méthode

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
Résultat void

setParamStringLength() public méthode

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
Résultat self