Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
Elgg\Logger Class Reference

Public Member Functions

 __construct (PluginHooksService $hooks, Config $config, Context $context)
 Constructor. More...
 
 setLevel ($level)
 Set the logging level. More...
 
 getLevel ()
 Get the current logging level. More...
 
 setDisplay ($display)
 Set whether the logging should be displayed to the user. More...
 
 log ($message, $level=self::NOTICE)
 Add a message to the log. More...
 
 error ($message)
 Log message at the ERROR level. More...
 
 warn ($message)
 Log message at the WARNING level. More...
 
 notice ($message)
 Log message at the NOTICE level. More...
 
 info ($message)
 Log message at the INFO level. More...
 
 dump ($data, $display=true)
 Dump data to log or screen. More...
 
 disable ()
 Temporarily disable logging and capture logs (before tests) More...
 
 enable ()
 Restore logging and get record of log calls (after tests) More...
 

Public Attributes

const OFF = 0
 
const ERROR = 400
 
const WARNING = 300
 
const NOTICE = 250
 
const INFO = 200
 

Protected Member Functions

 process ($data, $display, $level)
 Process logging data. More...
 

Protected Attributes

 $level = self::ERROR
 
 $display = false
 
 $hooks
 

Static Protected Attributes

static $levels
 

Detailed Description

Definition at line 15 of file Logger.php.

Constructor & Destructor Documentation

Elgg\Logger::__construct ( PluginHooksService  $hooks,
Config  $config,
Context  $context 
)

Constructor.

Parameters
PluginHooksService$hooksHooks service
Config$configConfig service
Context$contextContext service

Definition at line 68 of file Logger.php.

Member Function Documentation

Elgg\Logger::disable ( )

Temporarily disable logging and capture logs (before tests)

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.

Note
This behaves like a stack. You must call enable() for each disable() call.
Returns
void
See Also
enable private

Definition at line 267 of file Logger.php.

Elgg\Logger::dump (   $data,
  $display = true 
)

Dump data to log or screen.

Parameters
mixed$dataThe data to log
bool$displayWhether to include this in the HTML page
Returns
void

Definition at line 200 of file Logger.php.

Elgg\Logger::enable ( )

Restore logging and get record of log calls (after tests)

Returns
array
See Also
disable private

Definition at line 279 of file Logger.php.

Elgg\Logger::error (   $message)

Log message at the ERROR level.

Parameters
string$messageThe message to log
Returns
bool

Definition at line 159 of file Logger.php.

Elgg\Logger::getLevel ( )

Get the current logging level.

Returns
int

Definition at line 94 of file Logger.php.

Elgg\Logger::info (   $message)

Log message at the INFO level.

Parameters
string$messageThe message to log
Returns
bool

Definition at line 189 of file Logger.php.

Elgg\Logger::log (   $message,
  $level = self::NOTICE 
)

Add a message to the log.

Parameters
string$messageThe message to log
int$levelThe logging level
Returns
bool Whether the messages was logged

Definition at line 119 of file Logger.php.

Elgg\Logger::notice (   $message)

Log message at the NOTICE level.

Parameters
string$messageThe message to log
Returns
bool

Definition at line 179 of file Logger.php.

Elgg\Logger::process (   $data,
  $display,
  $level 
)
protected

Process logging data.

Parameters
mixed$dataThe data to process
bool$displayWhether to display the data to the user. Otherwise log it.
int$levelThe logging level for this data
Returns
void

Definition at line 212 of file Logger.php.

Elgg\Logger::setDisplay (   $display)

Set whether the logging should be displayed to the user.

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.

Parameters
bool$displayWhether to display logging
Returns
void

Definition at line 108 of file Logger.php.

Elgg\Logger::setLevel (   $level)

Set the logging level.

Parameters
int$levelThe logging level
Returns
void

Definition at line 80 of file Logger.php.

Elgg\Logger::warn (   $message)

Log message at the WARNING level.

Parameters
string$messageThe message to log
Returns
bool

Definition at line 169 of file Logger.php.

Member Data Documentation

Elgg\Logger::$display = false
protected

Definition at line 39 of file Logger.php.

Elgg\Logger::$hooks
protected

Definition at line 44 of file Logger.php.

Elgg\Logger::$level = self::ERROR
protected

Definition at line 34 of file Logger.php.

Elgg\Logger::$levels
staticprotected
Initial value:
= array(
0 => 'OFF',
200 => 'INFO',
250 => 'NOTICE',
300 => 'WARNING',
400 => 'ERROR',
)

Definition at line 23 of file Logger.php.

const Elgg\Logger::ERROR = 400

Definition at line 18 of file Logger.php.

const Elgg\Logger::INFO = 200

Definition at line 21 of file Logger.php.

const Elgg\Logger::NOTICE = 250

Definition at line 20 of file Logger.php.

const Elgg\Logger::OFF = 0

Definition at line 17 of file Logger.php.

const Elgg\Logger::WARNING = 300

Definition at line 19 of file Logger.php.


The documentation for this class was generated from the following file: