Elm  1.0
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Logging and pretty-printing

Classes

class  elm::color::Color
 Define ANSI colors (including foreground, background, bold and underline) for global use in std C/elm strings/outstreams, using implicit type conversions. More...
 
class  elm::log::Debug
 Provide necessary static methods for the use of ELM_DBG* macros. More...
 

Macros

#define ELM_DBG(str)   { if(elm::log::flags&elm::log::DEBUG) elm::cout << elm::log::Debug::debugPrefix(__FILE__, __LINE__) << str << elm::color::RCol(); }
 Format and output the string str on the log, depending on the global parameters set in flags and srcpath_length.
If ELM_NO_DBG is not defined, the alias DBG is available. More...
 
#define ELM_DBGLN(str)   { if(elm::log::flags&elm::log::DEBUG) elm::cout << elm::log::Debug::debugPrefix(__FILE__, __LINE__) << str << elm::color::RCol() << elm::io::endl; }
 The same as ELM_DBG, except it adds a new line character at the end.
If ELM_NO_DBG is not defined, the alias DBG is available. More...
 
#define ELM_DBGV(level, str)   { if(level & elm::log::verbose_level) ELM_DBG(str); }
 Will only output the string str if (level & verbose_level) is non-null, that is, if one of the bits in the bit mask level is set to 1 in the global variable verbose_level. More...
 

Variables

int elm::log::flags = DEBUG | COLOR | SOURCE_INFO | NUMBERING
 Flags to set for the debugging macros. More...
 
int elm::log::verbose_level = 0xffff
 Verbose bit mask. ELM_DBGV will only be enabled if the provided parameter level & verbose_level is non-null. More...
 
int elm::log::srcpath_length = 20
 Numeric value that defines the constant length of the source path in the prefix. More...
 
elm::color::Color elm::log::prefix_color = elm::color::Yel
 Color used for printing the prefix message. The default value is elm::color::Yel. More...
 

Detailed Description

Module for parametrized pretty-printing logs on the console, with colors, automatically prefixed by source path and such.

Macro Definition Documentation

#define ELM_DBG (   str)    { if(elm::log::flags&elm::log::DEBUG) elm::cout << elm::log::Debug::debugPrefix(__FILE__, __LINE__) << str << elm::color::RCol(); }

Format and output the string str on the log, depending on the global parameters set in flags and srcpath_length.
If ELM_NO_DBG is not defined, the alias DBG is available.

Parameters
strthe string to print
#define ELM_DBGLN (   str)    { if(elm::log::flags&elm::log::DEBUG) elm::cout << elm::log::Debug::debugPrefix(__FILE__, __LINE__) << str << elm::color::RCol() << elm::io::endl; }

The same as ELM_DBG, except it adds a new line character at the end.
If ELM_NO_DBG is not defined, the alias DBG is available.

Parameters
strthe string to print
#define ELM_DBGV (   level,
  str 
)    { if(level & elm::log::verbose_level) ELM_DBG(str); }

Will only output the string str if (level & verbose_level) is non-null, that is, if one of the bits in the bit mask level is set to 1 in the global variable verbose_level.

Parameters
strthe string to print
levelbitmask to select the levels of verbose that should enable this debug. If level=0, it will never be printed.

Variable Documentation

int elm::log::flags = DEBUG | COLOR | SOURCE_INFO | NUMBERING

Flags to set for the debugging macros.

  • DEBUG: Enable debugging
  • SOURCE_INFO: Display the source path (with line numbers)
  • NUMBERING: Number the log lines
  • COLOR/COLORS: Use colors

Referenced by elm::log::Debug::debugPrefix(), and elm::color::Color::operator()().

elm::color::Color elm::log::prefix_color = elm::color::Yel

Color used for printing the prefix message. The default value is elm::color::Yel.

Referenced by elm::log::Debug::debugPrefix().

int elm::log::srcpath_length = 20

Numeric value that defines the constant length of the source path in the prefix.

Warning
: must be > 3

Referenced by elm::log::Debug::debugPrefix().

int elm::log::verbose_level = 0xffff

Verbose bit mask. ELM_DBGV will only be enabled if the provided parameter level & verbose_level is non-null.