WC_Logger_Interface
in
WC Logger Interface
Functions that must be defined to correctly fulfill logger API.
Tags
Table of Contents
- add() : bool
- Add a log entry.
- alert() : mixed
- Adds an alert level message.
- critical() : mixed
- Adds a critical level message.
- debug() : mixed
- Adds a debug level message.
- emergency() : mixed
- Adds an emergency level message.
- error() : mixed
- Adds an error level message.
- info() : mixed
- Adds a info level message.
- log() : mixed
- Add a log entry.
- notice() : mixed
- Adds a notice level message.
- warning() : mixed
- Adds a warning level message.
Methods
add()
Add a log entry.
public
add(string $handle, string $message[, string $level = WC_Log_Levels::NOTICE ]) : bool
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
- $handle : string
-
File handle.
- $message : string
-
Log message.
- $level : string = WC_Log_Levels::NOTICE
-
Log level.
Return values
bool — True if log was added, otherwise false.alert()
Adds an alert level message.
public
alert(string $message[, array<string|int, mixed> $context = array() ]) : mixed
Action must be taken immediately. Example: Entire website down, database unavailable, etc.
Parameters
- $message : string
-
Log message.
- $context : array<string|int, mixed> = array()
-
Optional. Additional information for log handlers.
Return values
mixed —critical()
Adds a critical level message.
public
critical(string $message[, array<string|int, mixed> $context = array() ]) : mixed
Critical conditions. Example: Application component unavailable, unexpected exception.
Parameters
- $message : string
-
Log message.
- $context : array<string|int, mixed> = array()
-
Optional. Additional information for log handlers.
Return values
mixed —debug()
Adds a debug level message.
public
debug(string $message[, array<string|int, mixed> $context = array() ]) : mixed
Detailed debug information.
Parameters
- $message : string
-
Log message.
- $context : array<string|int, mixed> = array()
-
Optional. Additional information for log handlers.
Return values
mixed —emergency()
Adds an emergency level message.
public
emergency(string $message[, array<string|int, mixed> $context = array() ]) : mixed
System is unusable.
Parameters
- $message : string
-
Log message.
- $context : array<string|int, mixed> = array()
-
Optional. Additional information for log handlers.
Return values
mixed —error()
Adds an error level message.
public
error(string $message[, array<string|int, mixed> $context = array() ]) : mixed
Runtime errors that do not require immediate action but should typically be logged and monitored.
Parameters
- $message : string
-
Log message.
- $context : array<string|int, mixed> = array()
-
Optional. Additional information for log handlers.
Return values
mixed —info()
Adds a info level message.
public
info(string $message[, array<string|int, mixed> $context = array() ]) : mixed
Interesting events. Example: User logs in, SQL logs.
Parameters
- $message : string
-
Log message.
- $context : array<string|int, mixed> = array()
-
Optional. Additional information for log handlers.
Return values
mixed —log()
Add a log entry.
public
log(string $level, string $message[, array<string|int, mixed> $context = array() ]) : mixed
Parameters
- $level : string
-
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 : string
-
Log message.
- $context : array<string|int, mixed> = array()
-
Optional. Additional information for log handlers.
Return values
mixed —notice()
Adds a notice level message.
public
notice(string $message[, array<string|int, mixed> $context = array() ]) : mixed
Normal but significant events.
Parameters
- $message : string
-
Log message.
- $context : array<string|int, mixed> = array()
-
Optional. Additional information for log handlers.
Return values
mixed —warning()
Adds a warning level message.
public
warning(string $message[, array<string|int, mixed> $context = array() ]) : mixed
Exceptional occurrences that are not errors.
Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
Parameters
- $message : string
-
Log message.
- $context : array<string|int, mixed> = array()
-
Optional. Additional information for log handlers.