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 'woocommerce_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 WC_LOG_THRESHOLD. By default, all logs will be processed.
|
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
boolean
|
#
add( string $handle, string $message, string $level = WC_Log_Levels::NOTICE )
Add a log entry.
This is not the preferred method for adding log messages. Please use log() or any one of
the level methods (debug(), info(), etc.). This method may be deprecated in the future.
Parameters
Returns
boolean
Implementation of
|
public
|
#
log( string $level, string $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.
Implementation of
|
public
|
#
emergency( string $message, array $context = array() )
Adds an emergency level message.
Adds an emergency level message.
System is unusable.
Parameters
See
WC_Logger::log
Implementation of
|
public
|
#
alert( string $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
See
WC_Logger::log
Implementation of
|
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
See
WC_Logger::log
Implementation of
|
public
|
#
error( string $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
See
WC_Logger::log
Implementation of
|
public
|
#
warning( string $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
See
WC_Logger::log
Implementation of
|
public
|
#
notice( string $message, array $context = array() )
Adds a notice level message.
Adds a notice level message.
Normal but significant events.
Parameters
See
WC_Logger::log
Implementation of
|
public
|
#
info( string $message, array $context = array() )
Adds a info level message.
Adds a info level message.
Interesting events.
Example: User logs in, SQL logs.
Parameters
See
WC_Logger::log
Implementation of
|
public
|
#
debug( string $message, array $context = array() )
Adds a debug level message.
Adds a debug level message.
Detailed debug information.
Parameters
See
WC_Logger::log
Implementation of
|
public
boolean
|
#
clear( string $handle )
Clear entries from chosen file.
Clear entries from chosen file.
Deprecated
3.0.0
Parameters
Returns
boolean
|