code: def get_log_fpath(num='next', appname=None, log_dir=None):
      
      if log_dir is None:
          log_dir = get_logging_dir(appname=appname)
      if not exists(log_dir):
          os.makedirs(log_dir)
      if appname is not None:
          log_fname = appname + '_logs_%04d.out'
      else:
          log_fname = 'utool_logs_%04d.out'
      if isinstance(num, six.string_types):
          if num == 'next':
              count = 0
              log_fpath = join(log_dir, log_fname % count)
              while exists(log_fpath):
                  log_fpath = join(log_dir, log_fname % count)
                  count += 1
      else:
          log_fpath = join(log_dir, log_fname % num)
      return log_fpath
docs: Returns:
          log_fpath (str): path to log file