Methods summary
public
|
#
__construct( array $handlers = null, string $threshold = null )
Constructor for the logger.
Constructor for the logger.
Parameters
- $handlers
Optional. Array of log handlers. If $handlers is not provided,
the filter 'vsp_register_log_handlers' will be used to define the handlers.
If $handlers is provided, the filter will not be applied and the handlers will be
used directly.
- $threshold
Optional. Define an explicit threshold. May be configured
via VSP_LOG_THRESHOLD. By default, all logs will be processed.
|
public
|
#
log_errors( )
Ensures fatal errors are logged so they can be picked up in the status report.
Ensures fatal errors are logged so they can be picked up in the status report.
|
public
|
#
critical( string $message, array $context = array() )
Adds a critical level message.
Adds a critical level message.
Critical conditions.
Example: Application component unavailable, unexpected exception.
Parameters
Returns
$this
Implementation of
|
public
|
#
log( string $level, string|array $message, array $context = array() )
Add a log entry.
Parameters
- $level
One of the following:
'emergency': System is unusable.
'alert': Action must be taken immediately.
'critical': Critical conditions.
'error': Error conditions.
'warning': Warning conditions.
'notice': Normal but significant condition.
'info': Informational messages.
'debug': Debug-level messages.
- $message
- Log message.
- $context
- Optional. Additional information for log handlers.
Returns
$this
Implementation of
|
protected
boolean
|
#
should_handle( string $level )
Determine whether to handle or ignore log.
Determine whether to handle or ignore log.
Parameters
- $level
- emergency|alert|critical|error|warning|notice|info|debug
Returns
boolean True if the log should be handled.
|
public
|
#
emergency( string|array $message, array $context = array() )
Adds an emergency level message.
Adds an emergency level message.
System is unusable.
Parameters
Returns
$this
Implementation of
|
public
|
#
alert( string|array $message, array $context = array() )
Adds an alert level message.
Adds an alert level message.
Action must be taken immediately.
Example: Entire website down, database unavailable, etc.
Parameters
Returns
$this
Implementation of
|
public
|
#
error( string|array $message, array $context = array() )
Adds an error level message.
Adds an error level message.
Runtime errors that do not require immediate action but should typically be logged
and monitored.
Parameters
Returns
$this
Implementation of
|
public
|
#
warning( string|array $message, array $context = array() )
Adds a warning level message.
Adds a warning level message.
Exceptional occurrences that are not errors.
Example: Use of deprecated APIs, poor use of an API, undesirable things that are not
necessarily wrong.
Parameters
Returns
$this
Implementation of
|
public
|
#
notice( string|array $message, array $context = array() )
Adds a notice level message.
Adds a notice level message.
Normal but significant events.
Parameters
Returns
$this
Implementation of
|
public
|
#
info( string|array $message, array $context = array() )
Adds a info level message.
Adds a info level message.
Interesting events.
Example: User logs in, SQL logs.
Parameters
Returns
$this
Implementation of
|
public
|
#
debug( string|array $message, array $context = array() )
Adds a debug level message.
Adds a debug level message.
Detailed debug information.
Parameters
Returns
$this
Implementation of
|