NullLogger.php 707 B

123456789101112131415161718192021222324252627282930
  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. *
  20. * @return void
  21. *
  22. * @throws \Psr\Log\InvalidArgumentException
  23. */
  24. public function log($level, $message, array $context = array())
  25. {
  26. // noop
  27. }
  28. }