Add verbose flag to c2hal

By default compilers do not output messages to
the console except for warnings and errors.

All messages in c2hal that are not warnings or
errors are now silenced by default. Lower
severity messages can be enabled with the "-v"
flag.

Bug: 32851854
Test: make c2hal_test and check output
Change-Id: I0d3c137e4de560d97a31d0c3394dc6eeb3189c9c
diff --git a/c2hal/main.cpp b/c2hal/main.cpp
index b16772c..99b689b 100644
--- a/c2hal/main.cpp
+++ b/c2hal/main.cpp
@@ -57,12 +57,12 @@
 
 static bool isPathPrefix(const std::string &prefix, const std::string &base) {
     if (prefix.size() >= base.size()) {
-        LOG(INFO) << "Not long enough";
+        LOG(DEBUG) << "Not long enough";
         return false;
     }
 
     if (base[prefix.size()] != '.') {
-        LOG(INFO) << "not full";
+        LOG(DEBUG) << "not full";
         return false;
     }
 
@@ -111,9 +111,10 @@
     std::string package;
     std::map<std::string, std::string> packageRootPaths;
     bool isOpenGl = false;
+    bool verbose = false;
 
     int res;
-    while ((res = getopt(argc, argv, "gho:p:r:")) >= 0) {
+    while ((res = getopt(argc, argv, "ghvo:p:r:")) >= 0) {
         switch (res) {
             case 'o': {
                 outputDir = optarg;
@@ -127,6 +128,10 @@
                 isOpenGl = true;
                 break;
             }
+            case 'v': {
+                verbose = true;
+                break;
+            }
             case 'r':
             {
                 addPackageRootToMap(optarg, packageRootPaths);
@@ -148,6 +153,10 @@
         exit(0);
     }
 
+    if (verbose) {
+        SetMinimumLogSeverity(android::base::VERBOSE);
+    }
+
     applyPackageRootPath(packageRootPaths, package, outputDir);
 
     if (package.empty()) {
@@ -165,7 +174,7 @@
     for(int i = optind; i < argc; i++) {
         std::string path = argv[i];
 
-        LOG(INFO) << "Processing " << path;
+        LOG(DEBUG) << "Processing " << path;
 
         AST ast(path, outputDir, package, isOpenGl);