Trait Psr\Log\LoggerTrait

This is a simple Logger trait that classes unable to extend AbstractLogger (because they extend another class, etc) can include.

It simply delegates all log-level-specific methods to the log method to reduce boilerplate code that a simple Logger that does the same thing with messages regardless of the error level has to implement.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
alert() Action must be taken immediately. Psr\Log\LoggerTrait
critical() Critical conditions. Psr\Log\LoggerTrait
debug() Detailed debug information. Psr\Log\LoggerTrait
emergency() System is unusable. Psr\Log\LoggerTrait
error() Runtime errors that do not require immediate action but should typically be logged and monitored. Psr\Log\LoggerTrait
info() Interesting events. Psr\Log\LoggerTrait
log() Logs with an arbitrary level. Psr\Log\LoggerTrait
notice() Normal but significant events. Psr\Log\LoggerTrait
warning() Exceptional occurrences that are not errors. Psr\Log\LoggerTrait

Method Details

alert() public method

Action must be taken immediately.

Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.

public null alert ( $message, array $context = [] )
$message string
$context array
critical() public method

Critical conditions.

Example: Application component unavailable, unexpected exception.

public null critical ( $message, array $context = [] )
$message string
$context array
debug() public method

Detailed debug information.

public null debug ( $message, array $context = [] )
$message string
$context array
emergency() public method

System is unusable.

public null emergency ( $message, array $context = [] )
$message string
$context array
error() public method

Runtime errors that do not require immediate action but should typically be logged and monitored.

public null error ( $message, array $context = [] )
$message string
$context array
info() public method

Interesting events.

Example: User logs in, SQL logs.

public null info ( $message, array $context = [] )
$message string
$context array
log() public abstract method

Logs with an arbitrary level.

public abstract null log ( $level, $message, array $context = [] )
$level mixed
$message string
$context array
notice() public method

Normal but significant events.

public null notice ( $message, array $context = [] )
$message string
$context array
warning() public method

Exceptional occurrences that are not errors.

Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.

public null warning ( $message, array $context = [] )
$message string
$context array