Home Libraries Author Links

DebugAids: Debugging Support Facilities
[SysToMath Aids C++ Library]

Collaboration diagram for DebugAids: Debugging Support Facilities:

Detailed Description

Collection of some debugging support macros and functions.

These facilities are used throughout the other SysToMath Aids C++ Library modules.


Files

file  debugaids.hpp
 Definition of debugging support macros and functions.

Defines

#define StmDebugAidsErrmsg(msg)   StmDebugAidsErrmsgImpl_ (msg)
 Return the error message msg as std::string.
#define StmDebugAidsVerify(cond)   StmDebugAidsVerifyImpl_ (cond)
 Verify that the boolean condition cond is true.

Enumerations

enum  stm::SyslogFlags {
  stm::SyslogNoLog = 0x00000000,
  stm::SyslogInfo = 0x00000001,
  stm::LogInfo = 0x00000001,
  stm::SyslogWarning = 0x00000002,
  stm::LogWarning = 0x00000002,
  stm::SyslogError = 0x00000003,
  stm::LogError = 0x00000003,
  stm::SyslogLevelMask = 0x00000003,
  stm::LogLevelMask = 0x00000003,
  stm::SyslogPerror = 0x00010000,
  stm::LogPerror = 0x00010000,
  stm::SyslogNoPerror = 0x00020000,
  stm::LogNoPerror = 0x00020000
}
 Syslog flags. More...

Functions

void stm::initSyslog (bool perror=false, const std::string &prog=std::string())
 Initialize syslog().
void stm::syslog (const std::string &message, unsigned int flags=SyslogInfo)
 Output message to the system log according to flags.


Define Documentation

#define StmDebugAidsErrmsg ( msg   )     StmDebugAidsErrmsgImpl_ (msg)

Return the error message msg as std::string.

If the macro NDEBUG in not defined, that error message is preceded by the filename and line number of the invocation location. For conveniance inside msg std::ostringstream::operator<<() may be used.

Examples:
filesystest.cpp, and smartptrtest.cpp.

Definition at line 94 of file debugaids.hpp.

#define StmDebugAidsVerify ( cond   )     StmDebugAidsVerifyImpl_ (cond)

Verify that the boolean condition cond is true.

If the macro NDEBUG is defined or cond is true, the macro does nothing.

Else if cond is false, a dialog box pops up prompting for the action to be done offering the choice of ignoring the situation or of throwing a std::logic_error exception with cond as text.

On Windows systems, moreover, there is a choice to enter the debugger.

Examples:
smartptrtest.cpp, and sudoku.cpp.

Definition at line 106 of file debugaids.hpp.

Referenced by main().


Enumeration Type Documentation

enum stm::SyslogFlags

Syslog flags.

Enumerator:
SyslogNoLog  No logging.
SyslogInfo  Information log level.
LogInfo 
Deprecated:
Use stm::SyslogInfo instead.
SyslogWarning  Warning log level.
LogWarning 
Deprecated:
Use stm::SyslogWarning instead.
SyslogError  Error log level.
LogError 
Deprecated:
Use stm::SyslogError instead.
SyslogLevelMask  Log level mask.
LogLevelMask 
Deprecated:
Use stm::SyslogLevelMask instead.
SyslogPerror  If set, print to stderr as well.
LogPerror 
Deprecated:
Use stm::SyslogPerror instead.
SyslogNoPerror  If set, do not print to stderr as well.
LogNoPerror 
Deprecated:
Use stm::SyslogNoPerror instead.

Definition at line 120 of file debugaids.hpp.


Function Documentation

void stm::initSyslog ( bool  perror = false,
const std::string &  prog = std::string() 
)

Initialize syslog().

If perror is set, subsequent calls to syslog() will output their messages also to stderr. A non-empty prog serves as identifier of the logged messages.

void stm::syslog ( const std::string &  message,
unsigned int  flags = SyslogInfo 
)

Output message to the system log according to flags.

If flags contains the SyslogPerror flag or initSyslog() was called with perror set, message is also output on stderr.


© Copyright Tom Michaelis 2002-2007

Distributed under the SysToMath Software License (See the accompanying file license.txt or a copy at www.SysToMath.com).