function filterLog()

in torchci/components/LogViewer.tsx [8:56]


function filterLog(log: string): string {
  let negativeRegexes = [
    /Z Entering 'third_party/,
    /Z http\.https:\/\/github\.com\/\.extraheader/,
    /Z deleted: sha256/,
    /Z untagged: sha256/,
    /Z untagged: .*amazonaws/,
    /Z \s*adding: /,
    /Z \s*creating: /,
    /Z \s*inflating: /,
    /Z \s*extracting: /,
    /Z adding /,
    /Z copying /,
    /Z creating /,
    /Z refs\/remotes\/origin/,
    /Z Synchronizing submodule url for/,
    /Z Receiving objects:/,
    /Z Resolving deltas:/,
    /Z remote: Compressing objects:/,
    /Z Submodule path /,
    /Z remote: Counting objects:/,
    /Z [a-z0-9]{12}: Waiting/,
    /Z [a-z0-9]{12}: Pulling fs layer/,
    /Z [a-z0-9]{12}: Verifying Checksum/,
    /Z [a-z0-9]{12}: Download complete/,
    /Z [a-z0-9]{12}: Pull complete/,
    /Z url\.https:\/\/github\.com/,
    /Z Generating XML reports/,
    /Z Generated XML report/,
    /Z Test results will be stored/,
  ];

  const lines = log.split("\n");
  let newLog = "";

  for (const line of lines) {
    let include = true;
    for (const regex of negativeRegexes) {
      if (line.match(regex)) {
        include = false;
        break;
      }
    }
    if (include) {
      newLog += line + "\n";
    }
  }
  return newLog;
}