   "FBLPromise",
 ]
 
-var foundError = false
+private class ErrorLogger {
+  var foundError = false
+  func log(_ message: String) {
+    print(message)
+    foundError = true
+  }
 
-func genError(_ message: String) {
-  print(message)
-  foundError = true
+  func importLog(_ message: String, _ file: String, _ line: Int) {
+    log("Import Error: \(file):\(line) \(message)")
+  }
 }
 
-func checkFile(_ file: String, isPublic: Bool) {
+private func checkFile(_ file: String, logger: ErrorLogger, inRepo repoURL: URL, isPublic: Bool) {
   var fileContents = ""
   do {
     fileContents = try String(contentsOfFile: file, encoding: .utf8)
   } catch {
-    genError("Could not read \(file). \(error)")
+    logger.log("Could not read \(file). \(error)")
     // Not a source file, give up and return.
     return
   }

      let importFile = line.components(separatedBy: " ")[1]
      if inSwiftPackageElse {
        if importFile.first != "<" {
          genError("Import error: \(file):\(lineNum) Import in SWIFT_PACKAGE #else should start with \"<\".")
        }
        continue
      }

        // Public Headers should only use simple file names without paths.
        if isPublic {
          if importFile.contains("/") {
            logger.importLog("Public header import should not include \"/\"", file, lineNum)
          }

        } else if !FileManager.default.fileExists(atPath: repoURL.path + "/" + importFileRaw) {
