code: def log_to_file(filename, level=DEBUG):
      
      logger = logging.getLogger("paramiko")
      if len(logger.handlers) > 0:
          return
      logger.setLevel(level)
      f = open(filename, "a")
      handler = logging.StreamHandler(f)
      frm = "%(levelname)-.3s [%(asctime)s.%(msecs)03d] thr=%(_threadid)-3d"
      frm += " %(name)s: %(message)s"
      handler.setFormatter(logging.Formatter(frm, "%Y%m%d-%H:%M:%S"))
      logger.addHandler(handler)
docs: send paramiko logs to a logfile,
      if they're not already going somewhere