core-bundle/src/Monolog/ContaoTableHandler.php
private function createStatement(): void
    {
        if (null !== $this->statement) {
            return;
        }

        if (null === $this->container || !$this->container->has($this->dbalServiceName)) {
            throw new \RuntimeException('The container has not been injected or the database service is missing');
        }

        /** @var Connection $connection */
        $connection = $this->container->get($this->dbalServiceName);

        $this->statement = $connection->prepare('
            INSERT INTO
                tl_log
                    (tstamp, source, action, username, text, func, browser)
                VALUES
                    (:tstamp, :source, :action, :username, :text, :func, :browser)
        ');
    }
private function createStatement(): void
    {
        if (null !== $this->statement) {
            return;
        }

        if (null === $this->container || !$this->container->has($this->dbalServiceName)) {
            throw new \RuntimeException('The container has not been injected or the database service is missing');
        }

        /** @var Connection $connection */
        $connection = $this->container->get($this->dbalServiceName);

        $this->statement = $connection->prepare('
            INSERT INTO
                tl_log
                    (tstamp, source, action, username, text, func, browser)
                VALUES
                    (:tstamp, :source, :action, :username, :text, :func, :browser)
        ');
    }
Verifies the database connection and prepares the statement.

@throws \RuntimeException