NullLogger.php 641 B

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace Psr\Log;
  3. /**
  4. * This Logger can be used to avoid conditional log calls
  5. *
  6. * Logging should always be optional, and if no logger is provided to your
  7. * library creating a NullLogger instance to have something to throw logs at
  8. * is a good way to avoid littering your code with `if ($this->logger) { }`
  9. * blocks.
  10. */
  11. class NullLogger extends AbstractLogger
  12. {
  13. /**
  14. * Logs with an arbitrary level.
  15. *
  16. * @param mixed $level
  17. * @param string $message
  18. * @param array $context
  19. * @return null
  20. */
  21. public function log($level, $message, array $context = array())
  22. {
  23. // noop
  24. }
  25. }