fileFactory = $fileFactory; $this->quietFactory = $quietFactory; $this->loggerAlias = $loggerAlias; $this->logAllQueries = $logAllQueries; $this->logQueryTime = $logQueryTime; $this->logCallStack = $logCallStack; } /** * Get logger object. Initialize if needed. * @return LoggerInterface */ private function getLogger() { if ($this->logger === null) { switch ($this->loggerAlias) { case self::LOGGER_ALIAS_FILE: $this->logger = $this->fileFactory->create( [ 'logAllQueries' => $this->logAllQueries, 'logQueryTime' => $this->logQueryTime, 'logCallStack' => $this->logCallStack, ] ); break; default: $this->logger = $this->quietFactory->create(); break; } } return $this->logger; } /** * Adds log record * * @param string $str * @return void */ public function log($str) { $this->getLogger()->log($str); } /** * @param string $type * @param string $sql * @param array $bind * @param \Zend_Db_Statement_Pdo|null $result * @return void */ public function logStats($type, $sql, $bind = [], $result = null) { $this->getLogger()->logStats($type, $sql, $bind, $result); } /** * @param \Exception $exception * @return void */ public function critical(\Exception $exception) { $this->getLogger()->critical($exception); } /** * @return void */ public function startTimer() { $this->getLogger()->startTimer(); } }