logger = $logger; $this->outputType = $type; } /** * {@inheritdoc} */ public function startQuery($sql, array $params = null, array $types = null) { $this->start = microtime(true); $this->output["sql"] = $sql; if ($params) { $this->output["params"] = $params; } } /** * {@inheritdoc} */ public function stopQuery() { $mstime = microtime(true) - $this->start; $this->output["times"] = $mstime . " seconds"; if ($this->outputType == self::JSON) { $this->log(json_encode($this->output)); } elseif ($this->outputType == self::YAML) { $this->log(\Symfony\Component\Yaml\Yaml::dump($this->output)); } else { $this->log(var_export($this->output, true)); } } protected function log($message) { $this->logger->debug($message); } }