On 3 September 2013 09:22, Ulrich Mueller <u...@gentoo.org> wrote:

> I'd consider any tool as broken if it outputs escape sequences when
> the output doesn't go to a terminal. (Unless such output was
> explicitly asked for.)
>


However, what about when output is going to a terminal *and* a log file?

It seems smarter to output escape sequences in that case.

Additionally, although many people find escape sequences in log files
useless, I find them somewhat useful, for instance, if somebody uploads a
logfile with escape sequences in it, I can just run the file into "less -R"
or "less -r" depending on my mood and see the log file *Exactly* as the
user saw it.

I can see why you might not like it if you're reading it in a non-escape
aware editor, but I don't really use editors for reading log files, that
strikes me as doing something wrong.

And it is quite simple to remove escape sequences from log files if I
desire it.

using: app-text/ansifilter

 zcat
/var/log/portage/build/app-accessibility/at-spi2-core-2.6.3:20130825-143158.log.gz
| ansifilter

using perl and Term::ANSIColor ( standard issue with Perl itself )

zcat
/var/log/portage/build/app-accessibility/at-spi2-core-2.6.3:20130825-143158.log.gz
| perl -MTerm::ANSIColor=colorstrip -ple '$_ = colorstrip($_)'


-- 
Kent

Reply via email to