code: async def pipe_to_log(pipe, filehandles=(), level=logging.INFO):
      
      while True:
          line = await pipe.readline()
          if line:
              line = to_unicode(line)
              log.log(level, line.rstrip())
              for filehandle in filehandles:
                  print(line, file=filehandle, end="")
          else:
              break
docs: Log from a subprocess PIPE.
  
      Args:
          pipe (filehandle): subprocess process STDOUT or STDERR
          filehandles (list of filehandles, optional): the filehandle(s) to write
              to.  If empty, don't write to a separate file.  Defaults to ().
          level (int, optional): the level to log to.  Defaults to ``logging.INFO``.