run-tests: avoid duplicate code in vlog()
authorGregory Szorc <gregory.szorc@gmail.com>
Fri, 09 May 2014 15:55:58 -0700
changeset 21535 ab7e224bc089
parent 21534 3ece55d16044
child 21536 92a6b16c9186
run-tests: avoid duplicate code in vlog()
tests/run-tests.py
--- a/tests/run-tests.py	Fri Apr 25 15:34:28 2014 -0700
+++ b/tests/run-tests.py	Fri May 09 15:55:58 2014 -0700
@@ -295,17 +295,17 @@
 
 verbose = False
 def vlog(*msg):
-    if verbose is not False:
-        iolock.acquire()
-        if verbose:
-            print verbose,
-        for m in msg:
-            print m,
-        print
-        sys.stdout.flush()
-        iolock.release()
+    """Log only when in verbose mode."""
+    if verbose is False:
+        return
+
+    return log(*msg)
 
 def log(*msg):
+    """Log something to stdout.
+
+    Arguments are strings to print.
+    """
     iolock.acquire()
     if verbose:
         print verbose,