NullLogger.php 643 B

1234567891011121314151617181920212223242526
  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[] $context
  17. *
  18. * @throws \Psr\Log\InvalidArgumentException
  19. */
  20. public function log($level, string|\Stringable $message, array $context = []): void
  21. {
  22. // noop
  23. }
  24. }