Gentoo Archives: gentoo-dev

From: Kent Fredric <kentfredric@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] rfc: escape sequences in logs
Date: Mon, 02 Sep 2013 23:59:38
Message-Id: CAATnKFDzLTN76Y=Td_FuSFNVRM8JOX9_ssdTQmJDNedVcvAWNA@mail.gmail.com
In Reply to: Re: [gentoo-dev] rfc: escape sequences in logs by Ulrich Mueller
1 On 3 September 2013 09:22, Ulrich Mueller <ulm@g.o> wrote:
2
3 > I'd consider any tool as broken if it outputs escape sequences when
4 > the output doesn't go to a terminal. (Unless such output was
5 > explicitly asked for.)
6 >
7
8
9 However, what about when output is going to a terminal *and* a log file?
10
11 It seems smarter to output escape sequences in that case.
12
13 Additionally, although many people find escape sequences in log files
14 useless, I find them somewhat useful, for instance, if somebody uploads a
15 logfile with escape sequences in it, I can just run the file into "less -R"
16 or "less -r" depending on my mood and see the log file *Exactly* as the
17 user saw it.
18
19 I can see why you might not like it if you're reading it in a non-escape
20 aware editor, but I don't really use editors for reading log files, that
21 strikes me as doing something wrong.
22
23 And it is quite simple to remove escape sequences from log files if I
24 desire it.
25
26 using: app-text/ansifilter
27
28 zcat
29 /var/log/portage/build/app-accessibility/at-spi2-core-2.6.3:20130825-143158.log.gz
30 | ansifilter
31
32 using perl and Term::ANSIColor ( standard issue with Perl itself )
33
34 zcat
35 /var/log/portage/build/app-accessibility/at-spi2-core-2.6.3:20130825-143158.log.gz
36 | perl -MTerm::ANSIColor=colorstrip -ple '$_ = colorstrip($_)'
37
38
39 --
40 Kent