[rtems-source-builder commit] sb: Add a log capture interface to capture the console output.

Chris Johns chrisj at rtems.org
Fri Oct 27 06:27:06 UTC 2017


Module:    rtems-source-builder
Branch:    master
Commit:    723b638e02456efbc77385dcf3cff4ba987f4e9f
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=723b638e02456efbc77385dcf3cff4ba987f4e9f

Author:    Chris Johns <chrisj at rtems.org>
Date:      Fri Oct 27 17:23:25 2017 +1100

sb: Add a log capture interface to capture the console output.

- Increase the tail logged to 400 lines.

Update #3210.

---

 source-builder/sb/log.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/source-builder/sb/log.py b/source-builder/sb/log.py
index b0a9001..fa16874 100755
--- a/source-builder/sb/log.py
+++ b/source-builder/sb/log.py
@@ -1,6 +1,6 @@
 #
 # RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2010-2012 Chris Johns (chrisj at rtems.org)
+# Copyright 2010-2017 Chris Johns (chrisj at rtems.org)
 # All rights reserved.
 #
 # This file is part of the RTEMS Tools package in 'rtems-testing'.
@@ -34,6 +34,11 @@ import error
 default = None
 
 #
+# A global capture handler.
+#
+capture = None
+
+#
 # Global parameters.
 #
 tracing = False
@@ -69,6 +74,8 @@ def stderr(text = os.linesep, log = None):
     for l in text.replace(chr(13), '').splitlines():
         print(l, file = sys.stderr)
         sys.stderr.flush()
+    if capture is not None:
+        capture(text)
 
 def output(text = os.linesep, log = None):
     if not quiet:
@@ -79,6 +86,8 @@ def notice(text = os.linesep, log = None):
         for l in text.replace(chr(13), '').splitlines():
             print(l)
         sys.stdout.flush()
+        if capture is not None:
+            capture(text)
     _output(text, log)
 
 def trace(text = os.linesep, log = None):
@@ -104,7 +113,7 @@ def tail(log = None):
 
 class log:
     """Log output to stdout or a file."""
-    def __init__(self, streams = None, tail_size = 200):
+    def __init__(self, streams = None, tail_size = 400):
         self.tail = []
         self.tail_size = tail_size
         self.fhs = [None, None]



More information about the vc mailing list