From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 2/2] auto-t: timestamp log files in test-runner
Date: Wed, 14 Feb 2024 11:30:21 -0800 [thread overview]
Message-ID: <20240214193021.963130-2-prestwoj@gmail.com> (raw)
In-Reply-To: <20240214193021.963130-1-prestwoj@gmail.com>
The log files become much more useful when there are timestamps
associated with each log.
---
tools/utils.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/utils.py b/tools/utils.py
index 8219542e..5984fc69 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.
--
2.34.1
next prev parent reply other threads:[~2024-02-14 19:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-14 19:30 [PATCH 1/2] auto-t: fix failed_roam_test to pass when run on its own James Prestwood
2024-02-14 19:30 ` James Prestwood [this message]
2024-02-22 15:30 ` Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240214193021.963130-2-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox