Bug #1441

confusing colors - errors are not red, non-errors are red

Added by Markus Bertheau over 3 years ago. Updated almost 2 years ago.

Status:Closed Start date:07/21/2008
Priority:Normal Due date:
Assignee:James Turnbull % Done:

0%

Category:-
Target version:0.24.8
Affected Puppet version:0.24.4 Branch:
Keywords:
Votes: 0

Description

observed: * errors like a non-existant preseeding file are hidden in a notice type message * notices are red although they are not errors

expected: * only errors are red * errors like a non-existant preseeding file should be easy-to-spot in the log

log.rb.patch - Patch bringing puppet color codes in line with ANSI (2 kB) Duncan Hill, 07/23/2008 12:05 pm

Terminal_Colors.PNG - Output of a small script to display colors. (3.9 kB) BMDan -, 07/28/2008 04:46 pm

History

Updated by Luke Kanies over 3 years ago

  • Status changed from Unreviewed to Accepted
  • Assignee set to Puppet Community

What color codes would you recommend?

I chose colors that look appropriate in my terminal, so you clearly can’t leave it up to me to decide.

If you have better color choices, please provide a patch that sets them.

Updated by Duncan Hill over 3 years ago

No patch unfortunately (I’m on a deadline to get Tomcat and Glassfish playing nicely), however I’d suggest:

  • Red / hi-red: Critical error
  • Purple / hi-purple: Warnings
  • Green / hi-green: Normal / notice
  • White / hi-white: Debug

The only issue with green and red is that colour-blind users might not be able to determine the difference based on colour.

Is it worth making the colours configurable in the .conf file? It has to be parsed anyway.

Updated by James Turnbull over 3 years ago

  • Target version set to 0.25.0

Updated by Luke Kanies over 3 years ago

There’s no such thing as a “color” in the terminal, only terminal codes that translate to colors. I need to know what terminal codes people recommend, since I have no idea how to turn the colors into the right codes. Someone who has normal terminal colors will need to do the reverse translation for me.

As to make them configurable, it seems slightly overkill but I guess I’m not entirely opposed.

Updated by Duncan Hill over 3 years ago

Luke – see the patch on this comment. It’s against 0.24.4, which was the nearest version I had available to me. It brings the Puppet log colours in line with the ANSI codes and names, and makes a few changes to the hierarchy of colours.

Edit: It’s against puppet/util/log.rb.

Updated by Luke Kanies over 3 years ago

Ah, duh.

Debug as white?

I’ll let others comment on the colors. Does this work for people?

Updated by Duncan Hill over 3 years ago

Yeah, I’m not sure about white myself, but it was anything but dark blue which is nigh impossible to read on a dark screen. Hence the suggestion of making that array customisable somehow, even if it’s just two colour scheme choices (hi vs low) – low is sometimes hard to read on a black background, and hi colours on a light background is equally hard to read. The only other problem with that approach is that there are 8 levels, and 7 colours.

ANSI also gives you background colour control and underlining, but I’m content with just being able to use hi/bold colours.

Updated by Luke Kanies over 3 years ago

The solution to unreadable colors on your terminal is to change those colors so they’re readable. I actually prefer the blue as a debug color, but of course you’ll have to make it readable for that to work.

Updated by Markus Bertheau over 3 years ago

The new colors work for me, much better than before.

Updated by BMDan - over 3 years ago

Hereby heartily endorsing the provided patch. If I knew a damn bit of Ruby, I’d write the bit to make them configurable, but this is certainly a big step in the right direction. Red (31) is not appropriate for lines like “notice: Finished catalog run in 25.02 seconds”.

I’ve attached a picture of how each color code appears on my screen. I didn’t include any of the strange ones (blink, reverse video, etc.), as they’re often poorly-supported.

Updated by Duncan Hill over 3 years ago

Luke,

Regarding ‘just change my terminal interpretation of color codes’ – konsole doesn’t seem to support that, and I have to admit, I’ve never needed to do that before. As an example, my preferred editor (vim) has a boatload of pre-configured colour schemes, and I just pick one that works with my terminal setup (dark background vs light). putty, on the other hand, does support ANSI remapping, but drives me nuts.

Updated by Luke Kanies over 3 years ago

  • Status changed from Accepted to Ready For Checkin
  • Assignee changed from Puppet Community to James Turnbull

cricalix wrote:

Luke,

Regarding ‘just change my terminal interpretation of color codes’ – konsole doesn’t seem to support that, and I have to admit, I’ve never needed to do that before. As an example, my preferred editor (vim) has a boatload of pre-configured colour schemes, and I just pick one that works with my terminal setup (dark background vs light). putty, on the other hand, does support ANSI remapping, but drives me nuts.

But isn’t vim limited to just those color codes that your terminal supports? Or is it somehow magically showing more colors than your terminal can show?

I’m essentially fine with this patch, and if it pisses me off enough, I’ll make it configurable, I guess.

James, I haven’t tested the patch or anything, so at least make sure it’s syntactically valid and stuff before merging.

Updated by BMDan - over 3 years ago

luke wrote:

cricalix wrote:

Luke,

Regarding ‘just change my terminal interpretation of color codes’ – konsole doesn’t seem to support that, and I have to admit, I’ve never needed to do that before. As an example, my preferred editor (vim) has a boatload of pre-configured colour schemes, and I just pick one that works with my terminal setup (dark background vs light). putty, on the other hand, does support ANSI remapping, but drives me nuts.

But isn’t vim limited to just those color codes that your terminal supports? Or is it somehow magically showing more colors than your terminal can show?

I’m essentially fine with this patch, and if it pisses me off enough, I’ll make it configurable, I guess.

James, I haven’t tested the patch or anything, so at least make sure it’s syntactically valid and stuff before merging. http://en.wikipedia.org/wiki/ANSI_escape_code or http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf (esp. pp. 61-62) if you happen to enjoy pain.

Updated by James Turnbull over 3 years ago

  • Status changed from Ready For Checkin to Closed

Pushed in commit:6a2e71dd5fe16abaa64a92255a1bc8b592d2500f in branch 0.24.x

Updated by Luke Kanies over 2 years ago

  • Target version changed from 0.25.0 to 0.24.8

Also available in: Atom PDF