Presentation is loading. Please wait.

Presentation is loading. Please wait.

N ATIONAL E NERGY R ESEARCH S CIENTIFIC C OMPUTING C ENTER Charles Leggett Colors in the Message Service ATLAS software workshop March 3 2003 Architecture.

Similar presentations


Presentation on theme: "N ATIONAL E NERGY R ESEARCH S CIENTIFIC C OMPUTING C ENTER Charles Leggett Colors in the Message Service ATLAS software workshop March 3 2003 Architecture."— Presentation transcript:

1 N ATIONAL E NERGY R ESEARCH S CIENTIFIC C OMPUTING C ENTER Charles Leggett Colors in the Message Service ATLAS software workshop March 3 2003 Architecture Session

2 2 Charles Leggett How Colors are Generated â Only works for xterms (or things that work like xterms, eg kterm, gterm, etc). â Uses escape (denoted as ^[ ) sequences: l ^[[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 3 Charles Leggett 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 4 Charles Leggett â 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.Usage

5 5 Charles Leggett 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 6 Charles Leggett â To set the color of individual text, in your C++ code: l MsgStream::setColor( MSG::Color textColor ); l MsgStream::setColor( MSG::Color foreground, MSG::Color background ); l 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 attributeUsage

7 7 Charles Leggett 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 8 Charles Leggett Example Output â What it looks like

9 9 Charles Leggett Release Schedule â Will be part of Gaudi v12. â in release 6.1.0

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

11 11 Charles Leggett Normal Attribute

12 12 Charles Leggett Bold Attribute


Download ppt "N ATIONAL E NERGY R ESEARCH S CIENTIFIC C OMPUTING C ENTER Charles Leggett Colors in the Message Service ATLAS software workshop March 3 2003 Architecture."

Similar presentations


Ads by Google