Read lines from standard input or FILE(s), and write them to standard output with a timestamp prepended to each line.
tscat is most useful as a pipe, processing the standard output
of a relatively slow process for diagnostic purposes:
slowprogram | tscat
The original motivation for tscat was diagnosing slow SSH connections:
ssh -v gives lots of information, but it’s hard to remember after-the-fact
just which step was the slow one. The catch is that ssh writes its verbose
output to standard error rather than standard output, so to use it with
tscat requires a bit of shell trickery:
ssh -v ... 2>&1 | tscat
(requires a Bourne-style shell).
When run as a pipe, tscat is only useful if its standard input -- the standard output of the process being "watched" -- is line-buffered or unbuffered. Unfortunately, standard output typically becomes block-buffered when it is a pipe, thus defeating the utility of tscat. The moral of the story: if you are writing a program whose standard output might be slow, be sure to flush it regularly, or explictly force line buffering.
Greg Ward <gward-tscat at python dot net> or <greg-tscat at gerg dot ca>.
The latest version of tscat is always available from http://www.gerg.ca/software/tscat/ .
cat(1)