ErrorLevelActivationStrategy.php 759 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /*
  3. * This file is part of the Monolog package.
  4. *
  5. * (c) Jordi Boggiano <j.boggiano@seld.be>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Monolog\Handler\FingersCrossed;
  11. use Monolog\Logger;
  12. /**
  13. * Error level based activation strategy.
  14. *
  15. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  16. */
  17. class ErrorLevelActivationStrategy implements ActivationStrategyInterface
  18. {
  19. private $actionLevel;
  20. public function __construct($actionLevel)
  21. {
  22. $this->actionLevel = Logger::toMonologLevel($actionLevel);
  23. }
  24. public function isHandlerActivated(array $record)
  25. {
  26. return $record['level'] >= $this->actionLevel;
  27. }
  28. }