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.
Expanded class hierarchy of NullLogger
class NullLogger extends AbstractLogger {
/**
* Logs with an arbitrary level.
*
* @param mixed $level
* @param string $message
* @param array $context
* @return null
*/
public function log($level, $message, array $context = array()) {
// noop
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AbstractLogger:: |
public | function |
Action must be taken immediately. Overrides LoggerInterface:: |
|
AbstractLogger:: |
public | function |
Critical conditions. Overrides LoggerInterface:: |
|
AbstractLogger:: |
public | function |
Detailed debug information. Overrides LoggerInterface:: |
|
AbstractLogger:: |
public | function |
System is unusable. Overrides LoggerInterface:: |
|
AbstractLogger:: |
public | function |
Runtime errors that do not require immediate action but should typically
be logged and monitored. Overrides LoggerInterface:: |
|
AbstractLogger:: |
public | function |
Interesting events. Overrides LoggerInterface:: |
|
AbstractLogger:: |
public | function |
Normal but significant events. Overrides LoggerInterface:: |
|
AbstractLogger:: |
public | function |
Exceptional occurrences that are not errors. Overrides LoggerInterface:: |
|
NullLogger:: |
public | function |
Logs with an arbitrary level. Overrides LoggerInterface:: |