docs: def setup_logging(logfile, print_log_location=True, debug=False):
      '''
      Set up logging using the built-in ``logging`` package.
  
      A stream handler is added to all logs, so that logs at or above
      ``logging.INFO`` level are printed to screen as well as written
      to the log file.
  
      Arguments:
  
          logfile (str): Path to the log file. If the parent directory
              does not exist, it will be created. Required.
  
          print_log_location (bool): If ``True``, the log path will be
              written to the log upon initialization. Default is ``True``.
  
          debug (bool): If true, the log level will be set to ``logging.DEBUG``.
              If ``False``, the log level will be set to ``logging.INFO``.
              Default is ``False``.
      '''
      log_dir = os.path.dirname(logfile)
      make_dir(log_dir)
      fmt = '[%(levelname)s] %(name)s %(asctime)s %(message)s'
      if debug:
          logging.basicConfig(filename=logfile,
                              filemode='w',
                              format=fmt,
                              level=logging.DEBUG)
      else:
          logging.basicConfig(filename=logfile,
                              filemode='w',
                              format=fmt,
                              level=logging.INFO)
      logger = logging.getLogger('log')
      logger = add_stream_handler(logger)
      if print_log_location:
          logger.info('LOG LOCATION: {}'.format(logfile))