diff options
author | James Prestwood <prestwoj@gmail.com> | 2024-02-14 11:30:21 -0800 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2024-02-22 09:28:55 -0600 |
commit | c54ef5a8da5c3c1bda359df08e6eecb6c77a3f4a (patch) | |
tree | b89e31e45a1e886739eaee0437d0dfae8b5338c6 | |
parent | a507c08bfe4fa59497091dc800f04ccab37f16b8 (diff) |
auto-t: timestamp log files in test-runner
The log files become much more useful when there are timestamps
associated with each log.
-rw-r--r-- | tools/utils.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/utils.py b/tools/utils.py index 8219542e0..5984fc697 100644 --- a/tools/utils.py +++ b/tools/utils.py @@ -6,6 +6,7 @@ import traceback import shutil import dbus +from datetime import datetime from gi.repository import GLib from weakref import WeakValueDictionary from re import fullmatch @@ -125,7 +126,11 @@ class Process(subprocess.Popen): @staticmethod def _write_io(instance, data, stdout=True): for f in instance.write_fds: - f.write(data) + for c in data: + f.write(c) + if c == '\n': + stamp = datetime.strftime(datetime.now(), "%Y-%m-%d %H:%M:%S.%f") + f.write(stamp + ': ') # Write out a separator so multiple process calls per # test are easer to read. |