private function prepareLogsDir($logsDir)
    {
        if (!is_dir($logsDir)) {
            if (false === @mkdir($logsDir, 0777, true) && !is_dir($logsDir)) {
                throw new \RuntimeException(sprintf("Unable to create the logs directory (%s)\n", $logsDir));
            }
        } elseif (!is_writable($logsDir)) {
            throw new \RuntimeException(sprintf("Unable to write in the logs directory (%s)\n", $logsDir));
        }
    }