Use LoggerAwareTrait

Instead of implementing setLogger() ourselves
This commit is contained in:
Pierre Rudloff 2021-02-08 22:03:09 +01:00
parent f670629d49
commit 4977f99797

View file

@ -15,15 +15,17 @@ use Alltube\Library\Exception\WrongPasswordException;
use Alltube\Library\Exception\YoutubedlException; use Alltube\Library\Exception\YoutubedlException;
use GuzzleHttp\Client; use GuzzleHttp\Client;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\NullLogger; use Psr\Log\NullLogger;
use Symfony\Component\Process\Process; use Symfony\Component\Process\Process;
/** /**
* Class used to call youtube-dl and download videos. * Class used to call youtube-dl and download videos.
*/ */
class Downloader class Downloader implements LoggerAwareInterface
{ {
use LoggerAwareTrait;
/** /**
* youtube-dl binary path. * youtube-dl binary path.
@ -68,11 +70,6 @@ class Downloader
*/ */
private $params; private $params;
/**
* @var LoggerInterface
*/
private $logger;
/** /**
* Downloader constructor. * Downloader constructor.
* @param string $youtubedl youtube-dl binary path * @param string $youtubedl youtube-dl binary path
@ -100,15 +97,6 @@ class Downloader
$this->logger = new NullLogger(); $this->logger = new NullLogger();
} }
/**
* @param LoggerInterface $logger
* @return void
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
}
/** /**
* @param string $webpageUrl URL of the page containing the video * @param string $webpageUrl URL of the page containing the video
* @param string $requestedFormat Requested video format * @param string $requestedFormat Requested video format