回滚事务
支持设置回滚事务层数，如果不设置则为全部回滚
@param int $levels
@return boolean
435029
public function rollBack($levels = null): bool
    {
        $this->__tRollBack($levels);
        if(null === $levels)
        {
            return $this->instance->rollback();
        }
        else
        {
            $this->exec('ROLLBACK TO P' . ($this->getTransactionLevels()));
            return true;
        }
    }
963347
static function enable(Int $level = 0)
    {
        if (!self::$instance)
            self::$instance  = new self($level);

        if (!self::$locked)
            self::$instance->level = $level;
    }
953302
public static function toBitrixLevel($level)
    {
        $levels = static::logLevels();

        if (isset($levels[$level]))
        {
            return $levels[$level];
        }

        return false;
    }
1344420
private function loggerLevel($level)
    {
        switch ($level) {
            case 'trace':
            case 'debug':
                return Logger::DEBUG;
                break;

            case 'info':
                return Logger::INFO;
                break;

            case 'notice':
                return Logger::NOTICE;
                break;

            case 'warn':
            case 'warning':
                return Logger::WARNING;
                break;

            case 'error':
                return Logger::ERROR;
                break;

            case 'crit':
            case 'critical':
                return Logger::CRITICAL;
                break;

            case 'alert':
                return Logger::ALERT;
                break;

            case 'emergency':
                return Logger::EMERGENCY;
                break;

            default:
                throw new \Exception('Unknown Log Level', 1);
                break;
        }
    }
420882
public static function getLevelCode(
        /*# string */ $level
    )/*# : int */ {
        if (is_string($level) &&
            isset(self::$levels[$level])) {
            return self::$levels[$level];
        }

        throw new Exception\InvalidArgumentException(
            Message::get(
                Message::INVALID_LOG_LEVEL,
                (string) $level
            ),
            Message::INVALID_LOG_LEVEL
        );
    }
728725
public static function hasLevel(int $level=null) :bool {
		// if we have said level
		return self::$_account ? 
			self::getAccount()->hasLevel($level) : false;
	}
1110400
public function filterByLevel($level)
    {
        return $this->filter(function(LogEntry $entry) use ($level) {
            return $entry->isSameLevel($level);
        });
    }
301202
public function log($level, $message, array $context = array())
    {
        if (self::isSetLogger()) {
            return self::$logger->log($level, $message, $context);
        }

        return false;
    }
1077819
public function rollBack($toLevel = null)
    {
        // We allow developers to rollback to a certain transaction level. We will verify
        // that this given transaction level is valid before attempting to rollback to
        // that level. If it's not we will just return out and not attempt anything.
        $toLevel = is_null($toLevel)
                    ? $this->transactions - 1
                    : $toLevel;

        if ($toLevel < 0 || $toLevel >= $this->transactions) {
            return;
        }

        // Next, we will actually perform this rollback within this database and fire the
        // rollback event. We will also set the current transaction level to the given
        // level that was passed into this method so it will be right from here out.
        try {
            $this->performRollBack($toLevel);
        } catch (Exception $e) {
            $this->handleRollBackException($e);
        }

        $this->transactions = $toLevel;

        $this->fireConnectionEvent('rollingBack');
    }
871281
private function isValidLogLevel($level)
    {
        return in_array($level, array(
                LogLevel::EMERGENCY,
                LogLevel::ALERT,
                LogLevel::CRITICAL,
                LogLevel::ERROR,
                LogLevel::WARNING,
                LogLevel::NOTICE,
                LogLevel::INFO,
                LogLevel::DEBUG,
            )
        );
    }
213465
protected function isolationLevel(string $level)
    {
        if (!empty($level)) {
            $this->isProfiling() && $this->getLogger()->info("Set transaction isolation level to '{$level}'");
            $this->execute("SET TRANSACTION ISOLATION LEVEL {$level}");
        }
    }
311766
private function isChannelRegisterWithLogger($id, $level)
    {
        if (!isset($this->loggersChannel[$id])) {
            return true;
        }

        if ($this->isChannelTypeOf('inclusive', $id)) {
            return $this->levelExistsInList($level, $id);
        }

        if ($this->isChannelTypeOf('exclusive', $id)) {
            return !$this->levelExistsInList($level, $id);
        }

        return false;
    }
827183
public function renderNested(array $items, $level = 0)
    {
        $out = '';
        foreach ($items as $item) {
            $out .= $this->_renderItem($item, $level);
        }
        return $out;
    }
107205
public function filter($level, $allowed)
    {
        if (empty($allowed)) {
            return true;
        }

        if (is_array($allowed)) {
            $merges = array_values(array_uintersect($this->levels, $allowed, "strcasecmp"));
            if (in_array(strtolower($level), $merges)) {
                return true;
            }
        }

        return false;
    }
365104
public function serialize(Level $level, array $options = [])
    {
        $serialized = [
            'id' => $level->getUuid(),
            'name' => $level->getName(),
            'value' => $level->getValue(),
        ];

        return $serialized;
    }
1135893
static function alwaysLogMessage( $level )
    {
        $instance = eZDebug::instance();
        // If there is a global setting for this get the value
        // and unset it globally
        if ( isset( $GLOBALS['eZDebugAlwaysLog'] ) )
        {
            $instance->AlwaysLog = $GLOBALS['eZDebugAlwaysLog'] + $instance->AlwaysLog;
            unset( $GLOBALS['eZDebugAlwaysLog'] );
        }

        if ( !isset( $instance->AlwaysLog[$level] ) )
        {
            return false;
        }
        return $instance->AlwaysLog[$level];
    }
1205915
public function getMediaFolderByLevels($levels)
    {
        $qb = $this->createQueryBuilder('mf')
                   ->andWhere('mf._level IN (:levels)')
                   ->setParameter('levels', $levels)
                   ->orderBy('mf._leftnode', 'asc');

        return $qb->getQuery()->getResult();
    }