diff --git a/image_captcha/src/Controller/CaptchaImageGeneratorController.php b/image_captcha/src/Controller/CaptchaImageGeneratorController.php index 408c115..3354a28 100644 --- a/image_captcha/src/Controller/CaptchaImageGeneratorController.php +++ b/image_captcha/src/Controller/CaptchaImageGeneratorController.php @@ -4,7 +4,7 @@ namespace Drupal\image_captcha\Controller; use Drupal\Core\Config\Config; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; -use Drupal\Core\Logger\LoggerChannelInterface; +use Psr\Log\LoggerInterface; use Drupal\Core\PageCache\ResponsePolicy\KillSwitch; use Drupal\image_captcha\Response\CaptchaImageResponse; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -24,7 +24,7 @@ class CaptchaImageGeneratorController implements ContainerInjectionInterface { /** * Watchdog logger channel for captcha. * - * @var LoggerChannelInterface + * @var LoggerInterface */ protected $logger; @@ -38,7 +38,7 @@ class CaptchaImageGeneratorController implements ContainerInjectionInterface { /** * {@inheritdoc} */ - public function __construct(Config $config, LoggerChannelInterface $logger, KillSwitch $kill_switch) { + public function __construct(Config $config, LoggerInterface $logger, KillSwitch $kill_switch) { $this->config = $config; $this->logger = $logger; $this->killSwitch = $kill_switch; diff --git a/image_captcha/src/Response/CaptchaImageResponse.php b/image_captcha/src/Response/CaptchaImageResponse.php index d4c81db..2a08847 100755 --- a/image_captcha/src/Response/CaptchaImageResponse.php +++ b/image_captcha/src/Response/CaptchaImageResponse.php @@ -3,7 +3,7 @@ namespace Drupal\image_captcha\Response; use Drupal\Core\Config\Config; -use Drupal\Core\Logger\LoggerChannelInterface; +use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -14,6 +14,8 @@ use Symfony\Component\HttpFoundation\Response; */ class CaptchaImageResponse extends Response { + const LOG_LEVEL = 'ERROR'; + /** * Image Captcha config storage. * @@ -24,7 +26,7 @@ class CaptchaImageResponse extends Response { /** * Watchdog logger channel for captcha. * - * @var LoggerChannelInterface + * @var LoggerInterface */ protected $logger; @@ -38,7 +40,7 @@ class CaptchaImageResponse extends Response { /** * {@inheritdoc} */ - public function __construct(Config $config, LoggerChannelInterface $logger, $callback = NULL, $status = 200, $headers = []) { + public function __construct(Config $config, LoggerInterface $logger, $callback = NULL, $status = 200, $headers = []) { parent::__construct(NULL, $status, $headers); $this->config = $config; @@ -59,7 +61,7 @@ class CaptchaImageResponse extends Response { $this->image = @$this->generateImage($code); if (!$this->image) { - $this->logger->log(WATCHDOG_ERROR, 'Generation of image CAPTCHA failed. Check your image CAPTCHA configuration and especially the used font.', []); + $this->logger->log(self::LOG_LEVEL, 'Generation of image CAPTCHA failed. Check your image CAPTCHA configuration and especially the used font.', []); } }