[rtems-tools commit] rtemstoolkit: Add a capture hook to logging.

Chris Johns chrisj at rtems.org
Wed Oct 11 19:14:20 UTC 2017


Module:    rtems-tools
Branch:    master
Commit:    7c032b0939c5b1e53e6de64120d90e86ca69c2b1
Changeset: http://git.rtems.org/rtems-tools/commit/?id=7c032b0939c5b1e53e6de64120d90e86ca69c2b1

Author:    Chris Johns <chrisj at rtems.org>
Date:      Thu Oct 12 06:09:52 2017 +1100

rtemstoolkit: Add a capture hook to logging.

---

 rtemstoolkit/log.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/rtemstoolkit/log.py b/rtemstoolkit/log.py
index c442525..3eb2c1b 100755
--- a/rtemstoolkit/log.py
+++ b/rtemstoolkit/log.py
@@ -53,6 +53,11 @@ except (ValueError, SystemError):
 default = None
 
 #
+# A global capture handler.
+#
+capture = None
+
+#
 # Global parameters.
 #
 tracing = False
@@ -82,6 +87,10 @@ def _output(text = os.linesep, log = None):
         for l in text.replace(chr(13), '').splitlines():
             print(l)
         lock.release()
+    if capture is not None:
+        lock.acquire()
+        capture(text)
+        lock.release()
 
 def stderr(text = os.linesep, log = None):
     lock.acquire()



More information about the vc mailing list