public function captureQuery($query, $level = CLogger::LEVEL_INFO, $engine = '')
    {
        if (!$this->isEnvironmentEnabled()) {
            return null;
        }
        try {
            $eventId = $this->_client->getIdent(
                $this->_client->captureQuery($query, $level, $engine)
            );
        } catch (Exception $e) {
            if (YII_DEBUG) {
                throw new CException('SentryClient failed to log query: ' . $e->getMessage(), (int)$e->getCode());
            } else {
                $this->log($e->getMessage(), CLogger::LEVEL_ERROR);
                throw new CException('SentryClient failed to log query.', (int)$e->getCode());
            }
        }
        $this->_loggedEventIds[] = $eventId;
        $this->log(sprintf('Query logged to Sentry with event id: %d', $eventId), CLogger::LEVEL_INFO);
        return $eventId;
    }