public function endAllOutputBuffers($lvl = 0)
    {
        $ob_cnt = 0;
        while (ob_get_level() > $lvl)
        {
            ++$ob_cnt;
            $contents = ob_get_contents();
            ob_end_clean();
        
            if (self::$logger instanceof \Psr\Log\NullLogger)
                continue;

            $lines = explode("\n", $contents);
            foreach ($lines as $n => $line)
            {
                if (!empty($line))
                    self::$logger->debug("Script output: {0}/{1}: {2}", [$ob_cnt, $n + 1, $line]);
            }
        }
    }