3 ms·
could you prepend all messages with a timestamp (inc stdout), then reorder in your post-processing?
by foxhill 8y ago
could you prepend all messages with a timestamp (inc stdout), then reorder in your post-processing?
- amasad 8y agoNo, because we're running user programs we don't have control over and we're trying to avoid doing any magic in each language environment (which was the original approach that we decided to move away from).
- foxhill 8y agoi meant in a similar approach to capturing the output of each fd - i.e outside of the user’s programs
- amasad 8y agoWe're back to square one. If it's outside the program you've already lost precision.
- laumars 8y agoDepends on the shell. The shell I’ve been writing actually does the red highlighting of STDERR output natively without needing to monkey patch libc and still keeps the order of precision. Ironically it’s one feature I’ve never advertised because I thought it would irritate other users besides myself. I had no idea there was a demand for that kind of feature.
- amasad 8y agoSo what's your secret?
- laumars 8y agoOstensibly it’s the same as the Bash example above but because it’s baked into the shell itself I’m able to add a very minimal wrapper around the shells PTY to append some ANSI escape sequences. As an aside, I also started work on a feature in the shell to strip all SGR escape sequences (colour and text formatting) for people who prefer their shell output text only. But that proved a little more problematic because it proved impossible to reliably differentiate between processes that expect a TTY (eg top, lynx, etc) and thus would need to bypass the SGR stripping wrapper, from the processes that don't.