Class NullLogger - Stefanius67/XLogger GitHub Wiki
Full name: \Psr\Log\NullLogger
Parent class: \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.
Overview
Method | Description |
---|---|
alert | Action must be taken immediately. |
critical | Critical conditions. |
debug | Detailed debug information. |
emergency | System is unusable. |
error | Runtime errors that do not require immediate action but should typically be logged and monitored. |
info | Interesting events. |
log | Logs with an arbitrary level. |
notice | Normal but significant events. |
warning | Exceptional occurrences that are not errors. |
Methods
log
Logs with an arbitrary level.
public NullLogger::log(mixed $level, string $message, array $context = array()) : void
Parameters:
Parameter | Type | Description |
---|---|---|
level |
mixed | |
message |
string | |
context |
array |
go to top(#nulllogger)
Inherited methods
alert
Action must be taken immediately.
public AbstractLogger::alert(string $message, array $context = array()) : void
Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
Parameters:
Parameter | Type | Description |
---|---|---|
message |
string | |
context |
array |
go to top(#nulllogger)
critical
Critical conditions.
public AbstractLogger::critical(string $message, array $context = array()) : void
Example: Application component unavailable, unexpected exception.
Parameters:
Parameter | Type | Description |
---|---|---|
message |
string | |
context |
array |
go to top(#nulllogger)
debug
Detailed debug information.
public AbstractLogger::debug(string $message, array $context = array()) : void
Parameters:
Parameter | Type | Description |
---|---|---|
message |
string | |
context |
array |
go to top(#nulllogger)
emergency
System is unusable.
public AbstractLogger::emergency(string $message, array $context = array()) : void
Parameters:
Parameter | Type | Description |
---|---|---|
message |
string | |
context |
array |
go to top(#nulllogger)
error
Runtime errors that do not require immediate action but should typically be logged and monitored.
public AbstractLogger::error(string $message, array $context = array()) : void
Parameters:
Parameter | Type | Description |
---|---|---|
message |
string | |
context |
array |
go to top(#nulllogger)
info
Interesting events.
public AbstractLogger::info(string $message, array $context = array()) : void
Example: User logs in, SQL logs.
Parameters:
Parameter | Type | Description |
---|---|---|
message |
string | |
context |
array |
go to top(#nulllogger)
notice
Normal but significant events.
public AbstractLogger::notice(string $message, array $context = array()) : void
Parameters:
Parameter | Type | Description |
---|---|---|
message |
string | |
context |
array |
go to top(#nulllogger)
warning
Exceptional occurrences that are not errors.
public AbstractLogger::warning(string $message, array $context = array()) : void
Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
Parameters:
Parameter | Type | Description |
---|---|---|
message |
string | |
context |
array |
go to top(#nulllogger)