Logs.h File Reference

Management of different macros for logs, assertions etc. More...

Namespaces

namespace  Util
 

a set of useful element for debugging typically


Defines

#define LIBGEP_XVALTOSTR(msg)   #msg
 Helper for macro LIBGEP_VALTOSTR.
#define LIBGEP_VALTOSTR(msg)   LIBGEP_XVALTOSTR(msg)
 Macro to convert value to a string.
#define LIBGEP_LOCINFO   __FILE__ "(" LIBGEP_VALTOSTR(__LINE__) ")"
 Prepend file name and line number.
#define LIBGEP_OSTREAM_FUNCTION_INFO   "[" << LIBGEP_LOCINFO << ":" << __FUNCTION__ << "] "
 Prepend file name with line number and function name inside brackets on a stream.
#define LIBGEP_SUFX   "\t in " LIBGEP_LOCINFO
#define LIBGEP_SUFX_M(msg)   msg LIBGEP_SUFX
 Append file name and line number to the argument string.
#define LIBGEP_ASSERT_M(cond, msg)
 Assertion which display message before throwing Util::RuntimeError() if cond is failed.
#define LIBGEP_ASSERT(cond)
 Assertion which throw Util::RuntimeError() if cond is failed.
#define LIBGEP_DO_ON_DEBUG(expr)
 execute expr only if the DEBUG macro is activated
#define LIBGEP_DEBUG(msg)
 print msg only if the DEBUG macro is activated. msg can be written in "stream" format i.e you can write

Functions

std::ostream & Util::log ()
std::ostream & Util::verbose (const short verboselevel)
std::ostream & Util::error ()

Detailed Description

Management of different macros for logs, assertions etc.

Author:
Marek Ostaszewski <Marek.Ostaszewski@uni.lu> Sebastien Varrette <Sebastien.Varrette@uni.lu>
Date:
Thu Mar 27 2008

Copyright (c) 2008 Marek Ostaszewski, Sebastien Varrette (see COPYING)


Define Documentation

#define LIBGEP_ASSERT ( cond   ) 
Value:
if (!(cond)) {              \
  Util::error() << LIBGEP_OSTREAM_FUNCTION_INFO << "Assertion (" << LIBGEP_VALTOSTR(cond) << ") failed!\n"; \
  throw std::runtime_error("");         \
    }

Assertion which throw Util::RuntimeError() if cond is failed.

#define LIBGEP_ASSERT_M ( cond,
msg   ) 
Value:
if (!(cond)) {              \
  Util::error() << LIBGEP_OSTREAM_FUNCTION_INFO << "Assertion (" << LIBGEP_VALTOSTR(cond) << ") failed! : " << msg << ::std::endl; \
  throw std::runtime_error("");         \
    }

Assertion which display message before throwing Util::RuntimeError() if cond is failed.

#define LIBGEP_DEBUG ( msg   ) 

print msg only if the DEBUG macro is activated. msg can be written in "stream" format i.e you can write

 LIBGEP_DEBUG("an " << object << "is put in a stream");
#define LIBGEP_DO_ON_DEBUG ( expr   ) 

execute expr only if the DEBUG macro is activated

#define LIBGEP_LOCINFO   __FILE__ "(" LIBGEP_VALTOSTR(__LINE__) ")"

Prepend file name and line number.

#define LIBGEP_OSTREAM_FUNCTION_INFO   "[" << LIBGEP_LOCINFO << ":" << __FUNCTION__ << "] "

Prepend file name with line number and function name inside brackets on a stream.

#define LIBGEP_SUFX   "\t in " LIBGEP_LOCINFO
#define LIBGEP_SUFX_M ( msg   )     msg LIBGEP_SUFX

Append file name and line number to the argument string.

#define LIBGEP_VALTOSTR ( msg   )     LIBGEP_XVALTOSTR(msg)

Macro to convert value to a string.

#define LIBGEP_XVALTOSTR ( msg   )     #msg

Helper for macro LIBGEP_VALTOSTR.


Generated on Fri Dec 11 22:28:17 2009 for LibGEP by  doxygen 1.6.1