[test] Minor updates to pytest usage

- Add logging varibale
- Allow pytest to log to file when variable supplied

Signed-off-by: Timothy Chen <timothytim@google.com>
diff --git a/test/systemtest/test_utils.py b/test/systemtest/test_utils.py
index 8640bf2..4002a91 100644
--- a/test/systemtest/test_utils.py
+++ b/test/systemtest/test_utils.py
@@ -263,3 +263,12 @@
               return match
 
             line_of_output = b''
+
+# If logfile option was given, log all outputs to file.
+def setup_logfile(logger, logfile):
+    if logfile:
+        logger.debug("Logfile at %s" % (logfile))
+        logger.setLevel(logging.DEBUG)
+        fh = logging.FileHandler(filename=logfile, mode='w')
+        fh.setLevel(logging.DEBUG)
+        logger.addHandler(fh)