eXperiment robotics framework

Debug messages in the console

This header includes helper macros to debug error messages. More...
#define P(X)   std::cout << #X <<" = " << X << " "<< std::endl;
 Quick print variables that flushes.
#define O(X)   std::cout << #X <<" = " << X << " ";
 Quick print variables that does not flush.
#define I(X)   os << #X <<" = " << X << " ";
 Quick print variables that includes them in the "os" output stream.
#define MSG_WARN   "\033[1;33mWARNING: \033[0m"
 A Warning message.
#define MSG_WARNING   "\033[1;33mWARNING: \033[0m"
 A Warning message.
#define MSG_FAIL   "\033[1;31mFAILURE: \033[0m"
 A Failure message.
#define MSG_FAILURE   "\033[1;31mFAILURE: \033[0m"
 A Failure message.
#define MSG_CRIT   "\033[5;31mCRITICAL: \033[0m"
 A Critical message.
#define MSG_CRITICAL   "\033[5;31mCRITICAL: \033[0m"
 A Critical message.
#define MSG_OK   "\033[1;32mOK: \033[0m"
 An Ok message.
#define MSG_SUCCESS   "\033[1;32mOK: \033[0m"
 An Ok message.
#define MSG_BLACK(W)   "\033[1;30m" << W << "\033[0m"
 colored messages in black.
#define MSG_RED(W)   "\033[1;31m" << W << "\033[0m"
 colored messages in red.
#define MSG_GREEN(W)   "\033[1;32m" << W << "\033[0m"
 colored messages in green.
#define MSG_YELLOW(W)   "\033[1;33m" << W << "\033[0m"
 colored messages in yellow.
#define MSG_BLUE(W)   "\033[1;34m" << W << "\033[0m"
 colored messages in blue.
#define MSG_MAGENTA(W)   "\033[1;35m" << W << "\033[0m"
 colored messages in magenta.
#define MSG_CYAN(W)   "\033[1;36m" << W << "\033[0m"
 colored messages in cyan.
#define MSG_WHITE(W)   "\033[1;37m" << W << "\033[0m"
 colored messages in white.

Detailed Description

This header includes helper macros to debug error messages.

Author:
smogzer_at_gmail.com
Example of quick print variables:
// equivalent to cout << "foo" << foo;
O(foo);

// equivalent to cout <<"bar" << bar << endl;
P(bar);

// equivalent to cout << "foo" << foo <<"bar" << bar << endl;
O(foo);P(bar);
Example of warning messages:
cout << MSG_CRITICAL << "meltdown at any moment";
Example of color messages:
cout << MSG_YELLOW(foo) << endl;
cout << MSG_YELLOW("the sun is yellow") << endl;

Color codes.

Attribute, foreground and background colors
 \033[attr;fg;bgm
{attr} is one of following

      0       Reset All Attributes (return to normal mode)
      1       Bright (Usually turns on BOLD)
      2       Dim
      3       Underline
      5       Blink
      7       Reverse
      8       Hidden

{fg} is one of the following

      30      Black
      31      Red
      32      Green
      33      Yellow
      34      Blue
      35      Magenta
      36      Cyan
      37      White

 {bg} is equal to fg + 10 (black=40)

Define Documentation

#define I (  )     os << #X <<" = " << X << " ";

Quick print variables that includes them in the "os" output stream.

Definition at line 76 of file erf_debug.hpp.

#define MSG_BLACK (  )     "\033[1;30m" << W << "\033[0m"

colored messages in black.

Definition at line 109 of file erf_debug.hpp.

#define MSG_BLUE (  )     "\033[1;34m" << W << "\033[0m"

colored messages in blue.

Definition at line 125 of file erf_debug.hpp.

#define MSG_CRIT   "\033[5;31mCRITICAL: \033[0m"

A Critical message.

Definition at line 94 of file erf_debug.hpp.

#define MSG_CRITICAL   "\033[5;31mCRITICAL: \033[0m"

A Critical message.

Definition at line 97 of file erf_debug.hpp.

#define MSG_CYAN (  )     "\033[1;36m" << W << "\033[0m"

colored messages in cyan.

Definition at line 133 of file erf_debug.hpp.

#define MSG_FAIL   "\033[1;31mFAILURE: \033[0m"

A Failure message.

Definition at line 87 of file erf_debug.hpp.

#define MSG_FAILURE   "\033[1;31mFAILURE: \033[0m"

A Failure message.

Definition at line 90 of file erf_debug.hpp.

#define MSG_GREEN (  )     "\033[1;32m" << W << "\033[0m"

colored messages in green.

Definition at line 117 of file erf_debug.hpp.

#define MSG_MAGENTA (  )     "\033[1;35m" << W << "\033[0m"

colored messages in magenta.

Definition at line 129 of file erf_debug.hpp.

#define MSG_OK   "\033[1;32mOK: \033[0m"

An Ok message.

Definition at line 101 of file erf_debug.hpp.

Referenced by SignalsConnections::connect(), and Frame::~Frame().

#define MSG_RED (  )     "\033[1;31m" << W << "\033[0m"

colored messages in red.

Definition at line 113 of file erf_debug.hpp.

#define MSG_SUCCESS   "\033[1;32mOK: \033[0m"

An Ok message.

Definition at line 104 of file erf_debug.hpp.

#define MSG_WARN   "\033[1;33mWARNING: \033[0m"

A Warning message.

Definition at line 80 of file erf_debug.hpp.

Referenced by SignalsConnections::connect(), and operator>>().

#define MSG_WARNING   "\033[1;33mWARNING: \033[0m"

A Warning message.

Definition at line 83 of file erf_debug.hpp.

#define MSG_WHITE (  )     "\033[1;37m" << W << "\033[0m"

colored messages in white.

Definition at line 137 of file erf_debug.hpp.

#define MSG_YELLOW (  )     "\033[1;33m" << W << "\033[0m"

colored messages in yellow.

Definition at line 121 of file erf_debug.hpp.

#define O (  )     std::cout << #X <<" = " << X << " ";

Quick print variables that does not flush.

Definition at line 72 of file erf_debug.hpp.

#define P (  )     std::cout << #X <<" = " << X << " "<< std::endl;

Quick print variables that flushes.

Definition at line 68 of file erf_debug.hpp.

Referenced by operator>>().


The miarn project - written by Joao Xavier