Refactor logging

This commit is contained in:
2021-09-18 22:47:06 +03:00
parent c8cd41777f
commit 97b3d8206c
4 changed files with 23 additions and 31 deletions

View File

@ -144,8 +144,6 @@ final class Lookup
unset($consumers[$consumerKey]);
})->connect();
$this->logger->debug('Consumer created.', compact('address', 'topic', 'channel'));
$promise->onResolve(function (?\Throwable $e) use ($consumerKey, &$consumers) {
if (null !== $e) {
$this->logger->error($e->getMessage());
@ -163,13 +161,13 @@ final class Lookup
$this->watch($topic);
$this->logger->info('Subscribed', compact('topic', 'channel'));
$this->logger->info('Subscribed.', compact('topic', 'channel'));
}
public function unsubscribe(string $topic, string $channel): void
{
if (null === ($this->running[$topic][$channel] ?? null)) {
$this->logger->debug('Trying unsubscribe from non subscribed', compact('topic', 'channel'));
$this->logger->debug('Not subscribed.', compact('topic', 'channel'));
return;
}
@ -180,7 +178,7 @@ final class Lookup
unset($this->running[$topic]);
}
$this->logger->info('Unsubscribed', compact('topic', 'channel'));
$this->logger->info('Unsubscribed.', compact('topic', 'channel'));
}
private function watch(string $topic): void