aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Roxell <anders.roxell@linaro.org>2015-04-06 23:43:52 +0200
committerAnders Roxell <anders.roxell@linaro.org>2015-04-06 23:54:54 +0200
commit1c911305b78142cf0e78729b0dcae885bbcc7c39 (patch)
treeecd95858eae7d313fb3141ccd77b041afe21c4a3
parentd94fa82e98f852e3be5e5b55204616cbe28a66dc (diff)
stream-lava-log.py: FileOutput, move code into _print_output
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
-rwxr-xr-xstream-lava-log.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/stream-lava-log.py b/stream-lava-log.py
index 13bcb06..b30522a 100755
--- a/stream-lava-log.py
+++ b/stream-lava-log.py
@@ -35,12 +35,13 @@ class FileOutputHandler(object):
self.outputter = outputter
self.full_output = ""
- self.printed_output = self.full_output
+ self.printed_output = ""
def run(self):
while True:
self._update_output()
+ self._print_output()
if not self.outputter.is_running(): break
@@ -51,15 +52,15 @@ class FileOutputHandler(object):
def _update_output(self):
self.full_output = self.outputter.get_output()
- if self.printed_output:
- new_output = self.full_output[len(self.printed_output):]
- else:
- new_output = self.full_output
+
+ def _print_output(self):
if not self.full_output:
self.file_obj.write("No job output...\n")
- else:
- self.file_obj.write(new_output)
- self.file_obj.flush()
+
+ new_output = self.full_output[len(self.printed_output):]
+
+ self.file_obj.write(new_output)
+ self.file_obj.flush()
self.printed_output = self.full_output