[dvsim] Update log messages

Minor update to log messages. At the end of the sim, the scratch path is
printed again at the end to make it easy to get to it, especially for
long running regressions. This may be removed again in future.

Signed-off-by: Srikrishna Iyer <sriyer@google.com>
diff --git a/util/dvsim/FlowCfg.py b/util/dvsim/FlowCfg.py
index 584d2ac..2463a9b 100644
--- a/util/dvsim/FlowCfg.py
+++ b/util/dvsim/FlowCfg.py
@@ -457,11 +457,10 @@
     def gen_results(self):
         '''Public facing API for _gen_results().
         '''
-        results = []
         for item in self.cfgs:
             result = item._gen_results()
-            log.info("[results]: [%s]:\n%s\n\n", item.name, result)
-            results.append(result)
+            log.info("[results]: [%s]:\n%s\n", item.name, result)
+            log.info("[scratch_path]: [%s] [%s]", item.name, item.scratch_path)
             self.errors_seen |= item.errors_seen
 
         if self.is_primary_cfg:
@@ -492,7 +491,7 @@
         f = open(results_html_file, 'w')
         f.write(results_html)
         f.close()
-        log.info("[results summary]: %s [%s]", "generated for email purpose", results_html_file)
+        log.info("[results:email]: [%s]", results_html_file)
 
     def _publish_results(self):
         '''Publish results to the opentitan web server.
diff --git a/util/dvsim/FpvCfg.py b/util/dvsim/FpvCfg.py
index 3db6157..2963c1d 100644
--- a/util/dvsim/FpvCfg.py
+++ b/util/dvsim/FpvCfg.py
@@ -9,7 +9,7 @@
 from tabulate import tabulate
 
 from OneShotCfg import OneShotCfg
-from utils import subst_wildcards
+from utils import VERBOSE, subst_wildcards
 
 
 class FpvCfg(OneShotCfg):
@@ -128,6 +128,7 @@
         results_str += "### " + self.timestamp_long + "\n"
         if self.revision_string:
             results_str += "### " + self.revision_string + "\n"
+        results_str += "### Branch: " + self.branch + "\n"
         results_str += "\n"
 
         colalign = ("center", ) * len(self.summary_header)
@@ -221,6 +222,7 @@
         results_str += "### " + self.timestamp_long + "\n"
         if self.revision_string:
             results_str += "### " + self.revision_string + "\n"
+        results_str += "### Branch: " + self.branch + "\n"
         results_str += "### FPV Tool: " + self.tool.upper() + "\n"
         results_str += "### LogFile dir: " + self.scratch_path + "/default\n\n"
 
@@ -266,13 +268,12 @@
         with open(results_file, 'w') as f:
             f.write(self.results_md)
 
-        log.info("[results page]: [%s] [%s]", self.name, results_file)
-
         # Generate result summary
         if not self.cov:
             summary += ["N/A", "N/A", "N/A"]
         self.result_summary[self.name] = summary
 
+        log.log(VERBOSE, "[results page]: [%s] [%s]", self.name, results_file)
         return self.results_md
 
     def _publish_results(self):
diff --git a/util/dvsim/LintCfg.py b/util/dvsim/LintCfg.py
index ae26252..75627d3 100644
--- a/util/dvsim/LintCfg.py
+++ b/util/dvsim/LintCfg.py
@@ -12,7 +12,7 @@
 from tabulate import tabulate
 
 from OneShotCfg import OneShotCfg
-from utils import print_msg_list, subst_wildcards
+from utils import VERBOSE, print_msg_list, subst_wildcards
 
 
 class LintCfg(OneShotCfg):
@@ -50,6 +50,7 @@
         results_str += "### " + self.timestamp_long + "\n"
         if self.revision_string:
             results_str += "### " + self.revision_string + "\n"
+        results_str += "### Branch: " + self.branch + "\n"
         results_str += "\n"
 
 
@@ -116,6 +117,7 @@
         results_str += "### " + self.timestamp_long + "\n"
         if self.revision_string:
             results_str += "### " + self.revision_string + "\n"
+        results_str += "### Branch: " + self.branch + "\n"
         results_str += "### Lint Tool: " + self.tool.upper() + "\n\n"
 
         header = [
@@ -137,7 +139,7 @@
             result_data = Path(
                 subst_wildcards(self.build_dir, {"build_mode": mode.name}) +
                 '/results.hjson')
-            log.info("looking for result data file at %s", result_data)
+            log.info("[results:hjson]: [%s]: [%s]", self.name, result_data)
 
             try:
                 with result_data.open() as results_file:
@@ -219,9 +221,9 @@
             self.publish_results_md = self.results_md
 
         # Write results to the scratch area
-        self.results_file = self.scratch_path + "/results_" + self.timestamp + ".md"
-        with open(self.results_file, 'w') as f:
+        results_file = self.scratch_path + "/results_" + self.timestamp + ".md"
+        with open(results_file, 'w') as f:
             f.write(self.results_md)
 
-        log.info("[results page]: [%s] [%s]", self.name, self.results_file)
+        log.log(VERBOSE, "[results page]: [%s] [%s]", self.name, results_file)
         return self.results_md
diff --git a/util/dvsim/OneShotCfg.py b/util/dvsim/OneShotCfg.py
index 6e407ec..5687729 100644
--- a/util/dvsim/OneShotCfg.py
+++ b/util/dvsim/OneShotCfg.py
@@ -13,7 +13,7 @@
 from Deploy import CompileOneShot
 from FlowCfg import FlowCfg
 from Modes import BuildModes, Modes
-from utils import find_and_substitute_wildcards
+from utils import VERBOSE, find_and_substitute_wildcards
 
 
 class OneShotCfg(FlowCfg):
@@ -94,8 +94,8 @@
 
         # Stuff below only pertains to individual cfg (not primary cfg).
         if not self.is_primary_cfg:
-            # Print info
-            log.info("[scratch_dir]: [%s]: [%s]", self.name, self.scratch_path)
+            # Print scratch_path at the start:
+            log.info("[scratch_path]: [%s] [%s]", self.name, self.scratch_path)
 
             # Set directories with links for ease of debug / triage.
             self.links = {
diff --git a/util/dvsim/SimCfg.py b/util/dvsim/SimCfg.py
index 0d0d339..cabe658 100644
--- a/util/dvsim/SimCfg.py
+++ b/util/dvsim/SimCfg.py
@@ -183,8 +183,8 @@
                     'and there was no --tool argument on the command line.')
                 sys.exit(1)
 
-            # Print info:
-            log.info("[scratch_dir]: [%s]: [%s]", self.name, self.scratch_path)
+            # Print scratch_path at the start:
+            log.info("[scratch_path]: [%s] [%s]", self.name, self.scratch_path)
 
             # Set directories with links for ease of debug / triage.
             self.links = {
@@ -638,6 +638,7 @@
         results_str += "### " + self.timestamp_long + "\n"
         if self.revision_string:
             results_str += "### " + self.revision_string + "\n"
+        results_str += "### Branch: " + self.branch + "\n"
 
         # Add path to testplan, only if it has entries (i.e., its not dummy).
         if self.testplan.entries:
@@ -693,12 +694,10 @@
 
         # Write results to the scratch area
         results_file = self.scratch_path + "/results_" + self.timestamp + ".md"
-        f = open(results_file, 'w')
-        f.write(self.results_md)
-        f.close()
+        with open(results_file, 'w') as f:
+            f.write(self.results_md)
 
-        # Return only the tables
-        log.info("[results page]: [%s] [%s]", self.name, results_file)
+        log.log(VERBOSE, "[results page]: [%s] [%s]", self.name, results_file)
         return results_str
 
     def gen_results_summary(self):
@@ -720,6 +719,7 @@
         self.results_summary_md += "### " + self.timestamp_long + "\n"
         if self.revision_string:
             self.results_summary_md += "### " + self.revision_string + "\n"
+        self.results_summary_md += "### Branch: " + self.branch + "\n"
         self.results_summary_md += tabulate(table,
                                             headers="firstrow",
                                             tablefmt="pipe",
diff --git a/util/dvsim/SynCfg.py b/util/dvsim/SynCfg.py
index f408b79..9507c43 100644
--- a/util/dvsim/SynCfg.py
+++ b/util/dvsim/SynCfg.py
@@ -12,7 +12,7 @@
 from tabulate import tabulate
 
 from OneShotCfg import OneShotCfg
-from utils import print_msg_list, subst_wildcards
+from utils import VERBOSE, print_msg_list, subst_wildcards
 
 
 class SynCfg(OneShotCfg):
@@ -38,6 +38,7 @@
         results_str += "### " + self.timestamp_long + "\n"
         if self.revision_string:
             results_str += "### " + self.revision_string + "\n"
+        results_str += "### Branch: " + self.branch + "\n"
         results_str += "\n"
 
         self.results_summary_md = results_str + "\nNot supported yet.\n"
@@ -147,6 +148,7 @@
         results_str += "### " + self.timestamp_long + "\n"
         if self.revision_string:
             results_str += "### " + self.revision_string + "\n"
+        results_str += "### Branch: " + self.branch + "\n"
         results_str += "### Synthesis Tool: " + self.tool.upper() + "\n\n"
 
         # TODO: extend this to support multiple build modes
@@ -389,9 +391,9 @@
             # QoR history
 
         # Write results to the scratch area
-        self.results_file = self.scratch_path + "/results_" + self.timestamp + ".md"
-        log.info("Detailed results are available at %s", self.results_file)
-        with open(self.results_file, 'w') as f:
+        results_file = self.scratch_path + "/results_" + self.timestamp + ".md"
+        with open(results_file, 'w') as f:
             f.write(self.results_md)
 
+        log.log(VERBOSE, "[results page]: [%s] [%s]", self.name, results_file)
         return self.results_md