diff --git a/Client/Predis/Connection/ConnectionWrapper.php b/Client/Predis/Connection/ConnectionWrapper.php index be12638d..5edd1d3e 100644 --- a/Client/Predis/Connection/ConnectionWrapper.php +++ b/Client/Predis/Connection/ConnectionWrapper.php @@ -95,7 +95,16 @@ public function isConnected() */ public function writeRequest(CommandInterface $command) { - return $this->connection->writeRequest($command); + if (null === $this->logger) { + $this->connection->writeRequest($command); + return; + } + + $startTime = microtime(true); + $this->connection->writeRequest($command); + $duration = (microtime(true) - $startTime) * 1000; + + $this->logger->logCommand($this->commandToString($command), $duration, $this->getParameters()->alias); } /**