Class Psr\Log\NullLogger

InheritancePsr\Log\NullLogger » Psr\Log\AbstractLogger

This Logger can be used to avoid conditional log calls.

Logging should always be optional, and if no logger is provided to your library creating a NullLogger instance to have something to throw logs at is a good way to avoid littering your code with if ($this->logger) { } blocks.

Public Methods

Hide inherited methods

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

Method Details

log() public method

Logs with an arbitrary level.

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