1 / 12

Colors in the Message Service

Colors in the Message Service. ATLAS software workshop March 3 2003 Architecture Session. How Colors are Generated. Only works for xterms (or things that work like xterms, eg kterm, gterm, etc). Uses escape (denoted as ^[ ) sequences: ^[[91;1mRED^[[m  RED

hollie
Download Presentation

Colors in the Message Service

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Colors in the Message Service ATLAS software workshop March 3 2003 Architecture Session

  2. How Colors are Generated • Only works for xterms (or things that work like xterms, eg kterm, gterm, etc). • Uses escape (denoted as ^[ ) sequences: • ^[[91;1mRED^[[m  RED • Escape sequences can be used to set foreground and background colors, as well as font attributes, such as bold, underlined, italics, and blinking. • Support for italics and blinking not well supported by some versions of xterms. • I will never implement any blinking controls as blinking is evil.

  3. Defaults • By default, no colors are shown, and no escape sequences are inserted into the output stream. This prevents log files from getting cluttered up. • Once colored output is activated, the default is to print all warning messages in yellow, error messages in red, and fatal messages in blue on red. This can be overridden as desired. • The colors of all levels of messages sent to the message service can be individually set. • Specific text can also be colored. fatal messages in blue on red

  4. Usage • To enable colored output, in jobOption: messageSvc.useColors = true; • To set individual colors for the message levels, in the jobOption as vectors of strings: MessageSvc.fatalColorCode = {"blue", "red"}; MessageSvc.errorColorCode = {"white", "red"}; MessageSvc.warningColorCode = {"yellow"}; MessageSvc.infoColorCode = {"cyan"}; MessageSvc.debugColorCode = {""}; MessageSvc.verboseColorCode = {""}; • First color is the foreground, second which is optional, is the background.

  5. Usage • Alternatively, you can specify the xterm escape sequence: MessageSvc.fatalColorCode = { "[94;101;1m"}; MessageSvc.errorColorCode = { "[97;101;1m" }; MessageSvc.warningColorCode = { "[93;1m"}; MessageSvc.infoColorCode = { "[96;4m" }; MessageSvc.debugColorCode = { }; MessageSvc.verboseColorCode = { }; • You have to specify the actual escape sequence you want to use, minus the initial escape character. Color codes are appended at the end of this talk, and in the docs. This also allows you to set the font attribute.

  6. Usage • To set the color of individual text, in your C++ code: • MsgStream::setColor( MSG::Color textColor ); • MsgStream::setColor( MSG::Color foreground, MSG::Color background ); • MsgStream::resetColor(); MsgStream log(msgSvc(),name());log.setColor(MSG::GREEN);log << MSG::INFO << “This is in green. ”;log.setColor(MSG::YELLOW, MSG::BLUE);log << “This is in yellow on blue. ”;log.resetColor();log << “This is back to normal” << endreq; • setColor() sets the bold attribute

  7. Allowed Values • xterms only have a limited (8) range of colors allocated to them. These are: • black MSG::BLACK • red MSG::RED • green MSG::GREEN • yellow MSG::YELLOW • blue MSG::BLUE • purple MSG::PURPLE • cyan MSG::CYAN • white MSG::WHITE • These colors names are recognized by the MsgStream::setColor() command. • Any other string used as a jobOption will result in a your default color in bold.

  8. Example Output • What it looks like

  9. Release Schedule • Will be part of Gaudi v12. • in release 6.1.0

  10. xterm Color Codes • Format: • ^[[xx;zm set foreground color • ^[[xx;yy;zm set foreground and background colors • xx: foreground colors, n=0,7 • 30+n == low intensity, • 40+n == low intensity, reverse video • 90+n == high intensity • 100+n == high intensity, reverse video • yy: background colors, n=0,7 • 40+n == low intensity • 100+n == high intensity • The last character (z) before the “m”, is the font modifier: 1 == bold, 2==normal, 4 == underlined

  11. Normal Attribute

  12. Bold Attribute

More Related