Hiding or Ignoring Repeating Log Lines

My builds use an application that prints “empty” log lines every so often, when no other logs are being output, so that the user knows that the process is still running–their jobs aren’t hanging.
But these log lines are noisy. I’d like to mark them as being “hidden”, in a sense.

They look like this:

[--LOGS]      training-ABCDEFG: some stuff happened
[--LOGS]      training-ABCDEFG:
[--LOGS]      training-ABCDEFG:
[--LOGS]      training-ABCDEFG:
[--LOGS]      training-ABCDEFG: some stuff happened

I’d like to be able to mark those lines in the middle in such a way that they don’t appear in the formatted build logs.

I’m aware that travis_wait seems to have some magic keywords that does something similar. How does it work?

I developed a tool which might make dealing with build logs easier and I would like to hear what you think! might be helpful if you need a filtered view of the logs (disclaimer: I never used it so can’t say anything else).


travis_wait’s source can be found at https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_wait.bash. It prints a waiting message every minute and after the command’s exit, all its output at once.

travis_fold can also be used to collapse parts of a log.

The usage is travis_fold {start|stop} <fold_name>. It works by printing stuff that’s treated specially by the log viewer (so you can emulate it).

Note that it’s an internal function so use at your own risk.

Finally, a common way to show ongoing progress without littering the output is to use a console progress bar. (It would still litter the raw log but you don’t look at that often, do you.)

I found that the travis_jigger script, used in travis_wait, does exactly that

It’s an interesting tool, and could be worth trying, but may be too general.
I think that I could develop a hypothetical log preprocessor function, i.e. travis_filter that takes in regex filter(s) as a parameter ^\[--LOGS\]\W*training-.+:\W*$ and overwrites matching lines with non-matching lines using the carriage return.