Browse Source

Log same text to file and stdout (#3592)

Mike Smith 7 years ago
parent
commit
b66953caed
1 changed files with 9 additions and 9 deletions
  1. 9 9
      toolset/utils/output_helper.py

+ 9 - 9
toolset/utils/output_helper.py

@@ -41,21 +41,21 @@ def log(log_text=None, **kwargs):
         return
         return
 
 
     try:
     try:
-        if not quiet:
-            new_log_text = border or ''
-            for line in log_text.splitlines():
-                if line.strip() is not '':
-                    if prefix:
-                        new_log_text += Style.DIM + prefix + Style.RESET_ALL
-                    new_log_text += color + line + color_reset + os.linesep
-            new_log_text += border_bottom or ''
+        new_log_text = border or ''
+        for line in log_text.splitlines():
+            if line.strip() is not '':
+                if prefix:
+                    new_log_text += Style.DIM + prefix + Style.RESET_ALL
+                new_log_text += color + line + color_reset + os.linesep
+        new_log_text += border_bottom or ''
 
 
+        if not quiet:
             sys.stdout.write(Style.RESET_ALL + new_log_text)
             sys.stdout.write(Style.RESET_ALL + new_log_text)
             sys.stdout.flush()
             sys.stdout.flush()
 
 
         if file is not None and os.fstat(
         if file is not None and os.fstat(
                 file.fileno()).st_size < TOO_MANY_BYTES:
                 file.fileno()).st_size < TOO_MANY_BYTES:
-            file.write(seq.sub('', log_text + os.linesep))
+            file.write(seq.sub('', new_log_text))
             file.flush()
             file.flush()
     except:
     except:
         pass
         pass