Review Request: Enable kDebug/kWarning/kError colors when sending output to file instead of tty

Sergio Luis Martins iamsergio at gmail.com
Fri Feb 18 13:51:32 GMT 2011



> On Feb. 18, 2011, 9:40 a.m., David Faure wrote:
> > So does this work with `less` for instance? tail -f ? Or only with `cat`? Or how do you use this?
> > My question is, whether we should remove the isatty check or indeed only make it configurable.

It will work with any tool that outputs the file contents to a terminal ( cat, less, more, tail ). The terminal interprets the color codes.

I think it's best to have it configurable so you can still open if with kate without seeing codes like:  KStandardDirs::findExe:

Here's a way to grep for kErrors:

grep "\[0;31m" --color=never file.log


- Sergio Luis


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/100675/#review1482
-----------------------------------------------------------


On Feb. 17, 2011, 8:49 p.m., Sergio Luis Martins wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/100675/
> -----------------------------------------------------------
> 
> (Updated Feb. 17, 2011, 8:49 p.m.)
> 
> 
> Review request for kdelibs.
> 
> 
> Summary
> -------
> 
> The existing KDE_COLOR_DEBUG env variable enables colors for output sent to a tty.
> 
> This patch introduces a new variable, KDE_COLOR_DEBUG_ANY_FD, which enables colors sent to any file descriptor, not only terminals.
> 
> Use case:
> 
> I usually start the applications which I develop with &> application.log, and I need a fast way to read the logs and find any kError( colored red ) output quickly.
> 
> 
> Diffs
> -----
> 
>   kdecore/io/kdebug.cpp 210a44c 
> 
> Diff: http://git.reviewboard.kde.org/r/100675/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Sergio Luis
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20110218/c2a58d8c/attachment.htm>


More information about the kde-core-devel mailing list