changeset 3443:bf1d8bdfc44e

Do not log (and flush) if nothing to log.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Mon, 07 May 2007 08:37:36 +0200
parents 0db91097fcb0
children e378a9b4608e
files gub/oslog.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gub/oslog.py	Mon May 07 08:36:20 2007 +0200
+++ b/gub/oslog.py	Mon May 07 08:37:36 2007 +0200
@@ -57,6 +57,7 @@
         while proc.poll () is None:
             line = proc.stdout.readline ()
             self.log (line, level['output'], verbose)
+            # FIXME: how to yield time slice in python?
             time.sleep (0.0001)
 
         line = proc.stdout.readline ()
@@ -70,6 +71,8 @@
         return 0
 
     def log (self, str, threshold, verbose=None):
+        if not str:
+            return
         if not verbose:
             verbose = self.verbose
         if verbose >= threshold:
@@ -78,7 +81,6 @@
             self.log_file.write (str)
             self.log_file.flush ()
 
-
     # FIXME
     def action (self, str):
         self.log (str, level['action'], self.verbose)