class NullLogger

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.

Hierarchy

Expanded class hierarchy of NullLogger

1 file declares its use of NullLogger
NullLogger.php in drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/NullLogger.php

File

drupal/core/vendor/psr/log/Psr/Log/NullLogger.php, line 13

Namespace

Psr\Log
View source
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
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractLogger::alert public function Action must be taken immediately. Overrides LoggerInterface::alert
AbstractLogger::critical public function Critical conditions. Overrides LoggerInterface::critical
AbstractLogger::debug public function Detailed debug information. Overrides LoggerInterface::debug
AbstractLogger::emergency public function System is unusable. Overrides LoggerInterface::emergency
AbstractLogger::error public function Runtime errors that do not require immediate action but should typically be logged and monitored. Overrides LoggerInterface::error
AbstractLogger::info public function Interesting events. Overrides LoggerInterface::info
AbstractLogger::notice public function Normal but significant events. Overrides LoggerInterface::notice
AbstractLogger::warning public function Exceptional occurrences that are not errors. Overrides LoggerInterface::warning
NullLogger::log public function Logs with an arbitrary level. Overrides LoggerInterface::log