Hi Paul,

We've been discussing this amongst ourselves recently, and decided to open
up some communication about this bug/feature request. We looked at trying
to add timestamps in the way we wrap the autopkgtest runner, but ultimately
decided it made more sense and was cleaner to try and do something upstream
in autopkgtest.

I have a couple of questions regarding implementation. We thought it best
to get your feedback before creating an upstream MR.

I think it'd be possible to alter the tee command in the setup_trace
function in the autopkgtest executable to incorporate `ts`:
```
out_tee = subprocess.Popen(['tee', fifo_log],
stdin=subprocess.PIPE)
err_tee = subprocess.Popen(['tee', fifo_log, '-a', '/dev/stderr'],
stdin=subprocess.PIPE,
stdout=open('/dev/null', 'wb'))
```
But this'd make autopkgtest depend on the `moreutils` package.

Another option would be to have a different longer command which
essentially does the same as ts, but this removes the need for `moreutils`
as a dependency. Something like this:
```

exec &> >(stdbuf -o0 sed 's/%/%%/g' | xargs -d '\n' -I {} date '+%F %T
{}' | tee -a "/tmp/std.log" >/dev/null )

```
Another option to explore would be to add a similar option to the various
subprocesses in the runner executable. I worry by adding ts (or another
option) directly to the setup_trace function, we would get duplicate
timestamps, given that the autopkgtest runner uses adtlog, which already
has timestamps. So the main process has appropriate logs, but the
subprocesses do not.

Please let me know any feedback you have on the above ideas.

Regards,
Tim

Reply via email to