lib/transports/file/findLogPath.js
function findLogPath(appName, fileName) {
  fileName = fileName || 'log.log';
  var userData = appName ? null : utils.getUserData();
  appName = appName || getAppName();

  var homeDir = os.homedir ? os.homedir() : process.env.HOME;

  var dir;
  switch (process.platform) {
    case 'darwin': {
      dir = prepareDir(homeDir, 'Library', 'Logs', appName)
        .or(userData)
        .or(homeDir, 'Library', 'Application Support', appName)
        .result;
      break;
    }

    case 'win32': {
      dir = prepareDir(userData)
        .or(process.env.APPDATA, appName)
        .or(homeDir, 'AppData', 'Roaming', appName)
        .result;
      break;
    }

    default: {
      dir = prepareDir(userData)
        .or(process.env.XDG_CONFIG_HOME, appName)
        .or(homeDir, '.config', appName)
        .or(process.env.XDG_DATA_HOME, appName)
        .or(homeDir, '.local', 'share', appName)
        .result;
      break;
    }
  }

  if (dir) {
    return path.join(dir, fileName);
  }

  return false;
}
function findLogPath(appName, fileName) {
  fileName = fileName || 'log.log';
  var userData = appName ? null : utils.getUserData();
  appName = appName || getAppName();

  var homeDir = os.homedir ? os.homedir() : process.env.HOME;

  var dir;
  switch (process.platform) {
    case 'darwin': {
      dir = prepareDir(homeDir, 'Library', 'Logs', appName)
        .or(userData)
        .or(homeDir, 'Library', 'Application Support', appName)
        .result;
      break;
    }

    case 'win32': {
      dir = prepareDir(userData)
        .or(process.env.APPDATA, appName)
        .or(homeDir, 'AppData', 'Roaming', appName)
        .result;
      break;
    }

    default: {
      dir = prepareDir(userData)
        .or(process.env.XDG_CONFIG_HOME, appName)
        .or(homeDir, '.config', appName)
        .or(process.env.XDG_DATA_HOME, appName)
        .or(homeDir, '.local', 'share', appName)
        .result;
      break;
    }
  }

  if (dir) {
    return path.join(dir, fileName);
  }

  return false;
}
Try to determine a platform-specific path where can write logs
@param {string} [appName] Used to determine the last part of a log path
@param {string} [fileName='log.log']
@return {string|boolean}