function debugLog(message, type = 'info', logFileSync = false) {
  const date = new Date();
  let tag = '';

  switch (type) {
    case 'info':
      tag = '[INFO] ';
      break;

    case 'error':
      tag = '[ERROR]';
      break;

    case 'warn':
      tag = '[WARN] ';
      break;

    default:
      tag = '';
  }

  const processTag = '[main]';
  const pre = `${date.toISOString()} | ${processTag} ${tag} : `;
  const finalMessage = message.replace(/\n(.*)/g, `\n${pre}$1`);
  const noOpCallback = () => {};

  if (!logFileSync) {
    fs.appendFile(logFilePath, `${pre + finalMessage}\n`, {
      encoding: 'utf-8',
      flag: 'a',
    }, noOpCallback);
  }
  else {
    fs.appendFileSync(logFilePath, `${pre + finalMessage}\n`, {
      encoding: 'utf-8',
      flag: 'a',
    });
  }

  if (argv.indexOf('--verbose') !== -1) {
    console.debug(pre + finalMessage);
  }
  if (type === 'error') {
    console.debug(
      `\n\nLogs for this run is available here:\n    ${logFilePath}\n\n`,
    );
  }
}
Logs debug message in the console (with `--verbose` flag)
and file.

@param {string} message
Debug message to be printed

@param {"info" | "error" | "warn"} type
Type of log

@param {boolean} logFileSync
Should the log be saved to file synchronously