Use different declaration of logger for ORCID API

For some reason LoggerAwareInterface doesn't work
This commit is contained in:
Beatrycze Volk 2022-07-14 13:18:26 +02:00
parent 348dcbe8a9
commit 2561ee3da5
2 changed files with 22 additions and 9 deletions

View File

@ -12,23 +12,29 @@
namespace Kitodo\Dlf\Api\Orcid;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\Http\RequestFactory;
use TYPO3\CMS\Core\Log\LogManager;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* ORCID API Client class
**/
class Client implements LoggerAwareInterface
class Client
{
use LoggerAwareTrait;
/**
* constants for API endpoint
**/
const HOSTNAME = 'orcid.org';
const VERSION = '3.0';
/**
* This holds the logger
*
* @var LogManager
* @access protected
*/
protected $logger;
/**
* The ORCID API endpoint
*
@ -66,6 +72,7 @@ class Client implements LoggerAwareInterface
**/
public function __construct($orcid, RequestFactory $requestFactory)
{
$this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
$this->orcid = $orcid;
$this->requestFactory = $requestFactory;
}

View File

@ -13,17 +13,22 @@
namespace Kitodo\Dlf\Api\Orcid;
use Kitodo\Dlf\Common\Helper;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use TYPO3\CMS\Core\Http\RequestFactory;
use TYPO3\CMS\Core\Log\LogManager;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* ORCID profile API class
**/
class Profile implements LoggerAwareInterface
class Profile
{
use LoggerAwareTrait;
/**
* This holds the logger
*
* @var LogManager
* @access protected
*/
protected $logger;
/**
* The raw ORCID profile
@ -41,6 +46,7 @@ class Profile implements LoggerAwareInterface
**/
public function __construct($orcid)
{
$this->logger = GeneralUtility::makeInstance(LogManager::class)->getLogger(static::class);
$this->client = new Client($orcid, GeneralUtility::makeInstance(RequestFactory::class));
}