Use LoggerAwareTrait

This commit is contained in:
2021-01-24 17:33:21 +03:00
parent 23c8681376
commit 92e8ca0812

View File

@ -6,6 +6,7 @@ namespace Nsq;
use Composer\InstalledVersions; use Composer\InstalledVersions;
use PHPinnacle\Buffer\ByteBuffer; use PHPinnacle\Buffer\ByteBuffer;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger; use Psr\Log\NullLogger;
use Socket\Raw\Factory; use Socket\Raw\Factory;
@ -22,14 +23,14 @@ use const PHP_EOL;
*/ */
abstract class Connection abstract class Connection
{ {
use LoggerAwareTrait;
private string $address; private string $address;
private ?Socket $socket = null; private ?Socket $socket = null;
private bool $closed = false; private bool $closed = false;
private LoggerInterface $logger;
/** /**
* @var array{ * @var array{
* client_id: string, * client_id: string,
@ -42,12 +43,12 @@ abstract class Connection
public function __construct( public function __construct(
string $address, string $address,
LoggerInterface $logger = null,
string $clientId = null, string $clientId = null,
string $hostname = null, string $hostname = null,
string $userAgent = null, string $userAgent = null,
int $heartbeatInterval = null, int $heartbeatInterval = null,
int $sampleRate = 0, int $sampleRate = 0,
LoggerInterface $logger = null,
) { ) {
$this->address = $address; $this->address = $address;