Add some logs
This commit is contained in:
@ -116,6 +116,11 @@ abstract class Connection
|
|||||||
|
|
||||||
$this->stream->close();
|
$this->stream->close();
|
||||||
$this->stream = new NullStream();
|
$this->stream = new NullStream();
|
||||||
|
|
||||||
|
$this->logger->debug('{class} disconnected from {address}', [
|
||||||
|
'class' => static::class,
|
||||||
|
'address' => $this->address,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function handleError(Frame\Error $error): void
|
protected function handleError(Frame\Error $error): void
|
||||||
|
@ -69,6 +69,12 @@ final class Consumer extends Connection
|
|||||||
return call(function (): \Generator {
|
return call(function (): \Generator {
|
||||||
yield parent::connect();
|
yield parent::connect();
|
||||||
|
|
||||||
|
$this->logger->debug('Consumer {topic}:{channel} connected to {host}', [
|
||||||
|
'topic' => $this->topic,
|
||||||
|
'channel' => $this->channel,
|
||||||
|
'host' => $this->address,
|
||||||
|
]);
|
||||||
|
|
||||||
$this->run();
|
$this->run();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,20 @@ use function Amp\call;
|
|||||||
|
|
||||||
final class Producer extends Connection
|
final class Producer extends Connection
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
private string $address,
|
||||||
|
private ClientConfig $clientConfig,
|
||||||
|
private LoggerInterface $logger,
|
||||||
|
)
|
||||||
|
{
|
||||||
|
parent::__construct(
|
||||||
|
$this->address,
|
||||||
|
$this->clientConfig,
|
||||||
|
$this->logger,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public static function create(
|
public static function create(
|
||||||
string $address,
|
string $address,
|
||||||
ClientConfig $clientConfig = null,
|
ClientConfig $clientConfig = null,
|
||||||
@ -37,6 +51,10 @@ final class Producer extends Connection
|
|||||||
return call(function (): \Generator {
|
return call(function (): \Generator {
|
||||||
yield parent::connect();
|
yield parent::connect();
|
||||||
|
|
||||||
|
$this->logger->debug('Producer connected to {host}', [
|
||||||
|
'host' => $this->address,
|
||||||
|
]);
|
||||||
|
|
||||||
$this->run();
|
$this->run();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user