code: def logged_exec(cmd):
      
      logger = logging.getLogger('fades.exec')
      logger.debug("Executing external command: %r", cmd)
      p = subprocess.Popen(
          cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
      stdout = []
      for line in p.stdout:
          line = line[:-1]
          stdout.append(line)
          logger.debug(STDOUT_LOG_PREFIX + line)
      retcode = p.wait()
      if retcode:
          raise ExecutionError(retcode, cmd, stdout)
      return stdout
docs: Execute a command, redirecting the output to the log.