PHP Class Elgg\Logger

Use the elgg_* versions instead.
Since: 1.9.0
Mostra file Open project: elgg/elgg Class Usage Examples

Protected Properties

Property Type Description
$display Display to user?
$hooks PluginHooksService
$level The logging level
$levels

Public Methods

Method Description
__construct ( PluginHooksService $hooks, Config $config, elgg\Context $context ) Constructor
disable ( ) : void Temporarily disable logging and capture logs (before tests)
dump ( mixed $data, boolean $display = true ) : void Dump data to log or screen
enable ( ) : array Restore logging and get record of log calls (after tests)
error ( string $message ) : boolean Log message at the ERROR level
getLevel ( ) : integer Get the current logging level
info ( string $message ) : boolean Log message at the INFO level
log ( string $message, integer $level = self::NOTICE ) : boolean Add a message to the log
notice ( string $message ) : boolean Log message at the NOTICE level
setDisplay ( boolean $display ) : void Set whether the logging should be displayed to the user
setHooks ( PluginHooksService $hooks ) : void Reset the hooks service for this instance (testing)
setLevel ( integer $level ) : void Set the logging level
warn ( string $message ) : boolean Log message at the WARNING level

Protected Methods

Method Description
process ( mixed $data, boolean $display, integer $level ) : void Process logging data

Method Details

__construct() public method

Constructor
public __construct ( PluginHooksService $hooks, Config $config, elgg\Context $context )
$hooks PluginHooksService Hooks service
$config Config Config service
$context elgg\Context Context service

disable() public method

Call disable() before your tests and enable() after. enable() will return a list of calls to log() (and helper methods) that were not acted upon.
See also: enable
public disable ( ) : void
return void

dump() public method

Dump data to log or screen
public dump ( mixed $data, boolean $display = true ) : void
$data mixed The data to log
$display boolean Whether to include this in the HTML page
return void

enable() public method

Restore logging and get record of log calls (after tests)
See also: disable
public enable ( ) : array
return array

error() public method

Log message at the ERROR level
public error ( string $message ) : boolean
$message string The message to log
return boolean

getLevel() public method

Get the current logging level
public getLevel ( ) : integer
return integer

info() public method

Log message at the INFO level
public info ( string $message ) : boolean
$message string The message to log
return boolean

log() public method

Add a message to the log
public log ( string $message, integer $level = self::NOTICE ) : boolean
$message string The message to log
$level integer The logging level
return boolean Whether the messages was logged

notice() public method

Log message at the NOTICE level
public notice ( string $message ) : boolean
$message string The message to log
return boolean

process() protected method

Process logging data
protected process ( mixed $data, boolean $display, integer $level ) : void
$data mixed The data to process
$display boolean Whether to display the data to the user. Otherwise log it.
$level integer The logging level for this data
return void

setDisplay() public method

Whether data is actually displayed to the user depends on this setting and other factors such as whether we are generating a JavaScript or CSS file.
public setDisplay ( boolean $display ) : void
$display boolean Whether to display logging
return void

setHooks() public method

Reset the hooks service for this instance (testing)
public setHooks ( PluginHooksService $hooks ) : void
$hooks PluginHooksService
return void

setLevel() public method

Set the logging level
public setLevel ( integer $level ) : void
$level integer The logging level
return void

warn() public method

Log message at the WARNING level
public warn ( string $message ) : boolean
$message string The message to log
return boolean

Property Details

$display protected_oe property

Display to user?
protected $display

$hooks protected_oe property

protected PluginHooksService,elgg $hooks
return PluginHooksService

$level protected_oe property

The logging level
protected $level

$levels protected_oe static_oe property

protected static $levels