Commit 6f472b65 authored by hswong3i's avatar hswong3i Committed by elachlan

Issue #2910900 by fwrdeu, hswong3i: Incompatibility with PSR-3 and Monolog replacing Watchdog

parent 363bdbb1
......@@ -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 \Drupal\Core\Logger\LoggerChannelInterface
* @var \Psr\Log\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;
......
......@@ -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 \Drupal\Core\Logger\LoggerChannelInterface
* @var \Psr\Log\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;
......@@ -62,7 +64,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.', []);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment