Skip to content

Commit

Permalink
ktest: Write to stdout if no log file is given
Browse files Browse the repository at this point in the history
If no LOG_FILE option is set, then write what would be logged to
that file to standard output.

Signed-off-by: Steven Rostedt <[email protected]>
  • Loading branch information
Steven Rostedt authored and rostedt committed Nov 18, 2010
1 parent 9386c6a commit d1e2f22
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions tools/testing/ktest/ktest.pl
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -230,17 +230,25 @@ 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 @_;
close(OUT);
}
}

sub logit {
if (defined($opt{"LOG_FILE"})) {
_logit @_;
} else {
print @_;
}
}

sub doprint {
print @_;
logit @_;
_logit @_;
}

sub run_command;
Expand Down

0 comments on commit d1e2f22

Please sign in to comment.