summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2017-10-27 17:23:25 +1100
committerChris Johns <chrisj@rtems.org>2017-10-27 17:26:26 +1100
commit723b638e02456efbc77385dcf3cff4ba987f4e9f (patch)
tree1a9d37ddef30ba2946b14747bd25c5de74e1ef9d
parentsb: Add a defined check. (diff)
downloadrtems-source-builder-723b638e02456efbc77385dcf3cff4ba987f4e9f.tar.bz2
sb: Add a log capture interface to capture the console output.
- Increase the tail logged to 400 lines. Update #3210.
-rwxr-xr-xsource-builder/sb/log.py13
1 files 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@rtems.org)
+# Copyright 2010-2017 Chris Johns (chrisj@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]