ktest: Write to stdout if no log file is given
authorSteven Rostedt <srostedt@redhat.com>
Mon, 8 Nov 2010 21:39:57 +0000 (16:39 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Thu, 18 Nov 2010 16:23:10 +0000 (11:23 -0500)
If no LOG_FILE option is set, then write what would be logged to
that file to standard output.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
tools/testing/ktest/ktest.pl [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 5bd0075..0a5ed0d
@@ -230,7 +230,7 @@ sub read_config {
     }
 }
 
-sub logit {
+sub _logit {
     if (defined($opt{"LOG_FILE"})) {
        open(OUT, ">> $opt{LOG_FILE}") or die "Can't write to $opt{LOG_FILE}";
        print OUT @_;
@@ -238,9 +238,17 @@ sub logit {
     }
 }
 
+sub logit {
+    if (defined($opt{"LOG_FILE"})) {
+       _logit @_;
+    } else {
+       print @_;
+    }
+}
+
 sub doprint {
     print @_;
-    logit @_;
+    _logit @_;
 }
 
 sub run_command;