|
@ -12,19 +12,19 @@ extern log4cplus::Logger logger; |
|
|
* Define the macros STORM_LOG_DEBUG and STORM_LOG_TRACE. |
|
|
* Define the macros STORM_LOG_DEBUG and STORM_LOG_TRACE. |
|
|
*/ |
|
|
*/ |
|
|
#define STORM_LOG_DEBUG(message) \ |
|
|
#define STORM_LOG_DEBUG(message) \ |
|
|
{ \ |
|
|
|
|
|
|
|
|
do { \ |
|
|
LOG4CPLUS_DEBUG(logger, message); \ |
|
|
LOG4CPLUS_DEBUG(logger, message); \ |
|
|
} while (false) \ |
|
|
} while (false) \ |
|
|
|
|
|
|
|
|
#define STORM_LOG_TRACE(message) \ |
|
|
#define STORM_LOG_TRACE(message) \ |
|
|
{ \ |
|
|
|
|
|
|
|
|
do { \ |
|
|
LOG4CPLUS_TRACE(logger, message); \ |
|
|
LOG4CPLUS_TRACE(logger, message); \ |
|
|
} while (false) \ |
|
|
} while (false) \ |
|
|
|
|
|
|
|
|
// Define STORM_LOG_ASSERT which is only checked when NDEBUG is not set. |
|
|
// Define STORM_LOG_ASSERT which is only checked when NDEBUG is not set. |
|
|
#ifndef NDEBUG |
|
|
#ifndef NDEBUG |
|
|
#define STORM_LOG_ASSERT(cond, message) \ |
|
|
#define STORM_LOG_ASSERT(cond, message) \ |
|
|
{ \ |
|
|
|
|
|
|
|
|
do { \ |
|
|
if (!(cond)) { \ |
|
|
if (!(cond)) { \ |
|
|
LOG4CPLUS_ERROR(logger, message); \ |
|
|
LOG4CPLUS_ERROR(logger, message); \ |
|
|
assert(cond); \ |
|
|
assert(cond); \ |
|
@ -36,7 +36,7 @@ assert(cond); \ |
|
|
#endif |
|
|
#endif |
|
|
// Define STORM_LOG_THROW to always throw the exception with the given message if the condition fails to hold. |
|
|
// Define STORM_LOG_THROW to always throw the exception with the given message if the condition fails to hold. |
|
|
#define STORM_LOG_THROW(cond, exception, message) \ |
|
|
#define STORM_LOG_THROW(cond, exception, message) \ |
|
|
{ \ |
|
|
|
|
|
|
|
|
do { \ |
|
|
if (!(cond)) { \ |
|
|
if (!(cond)) { \ |
|
|
LOG4CPLUS_ERROR(logger, message); \ |
|
|
LOG4CPLUS_ERROR(logger, message); \ |
|
|
throw exception() << message; \ |
|
|
throw exception() << message; \ |
|
@ -46,36 +46,36 @@ assert(cond); \ |
|
|
|
|
|
|
|
|
// Define STORM_LOG_WARN, STORM_LOG_ERROR and STORM_LOG_INFO to log the given message with the corresponding log levels. |
|
|
// Define STORM_LOG_WARN, STORM_LOG_ERROR and STORM_LOG_INFO to log the given message with the corresponding log levels. |
|
|
#define STORM_LOG_WARN(message) \ |
|
|
#define STORM_LOG_WARN(message) \ |
|
|
{ \ |
|
|
|
|
|
|
|
|
do { \ |
|
|
LOG4CPLUS_WARN(logger, message); \ |
|
|
LOG4CPLUS_WARN(logger, message); \ |
|
|
} while (false) \ |
|
|
} while (false) \ |
|
|
|
|
|
|
|
|
#define STORM_LOG_WARN_COND(cond, message) \ |
|
|
#define STORM_LOG_WARN_COND(cond, message) \ |
|
|
{ \ |
|
|
|
|
|
|
|
|
do { \ |
|
|
if (!(cond)) { \ |
|
|
if (!(cond)) { \ |
|
|
LOG4CPLUS_WARN(logger, message); \ |
|
|
LOG4CPLUS_WARN(logger, message); \ |
|
|
} \ |
|
|
} \ |
|
|
} while (false) \ |
|
|
} while (false) \ |
|
|
|
|
|
|
|
|
#define STORM_LOG_INFO(message) \ |
|
|
#define STORM_LOG_INFO(message) \ |
|
|
{ \ |
|
|
|
|
|
|
|
|
do { \ |
|
|
LOG4CPLUS_INFO(logger, message); \ |
|
|
LOG4CPLUS_INFO(logger, message); \ |
|
|
} while (false) \ |
|
|
} while (false) \ |
|
|
|
|
|
|
|
|
#define STORM_LOG_INFO_COND(cond, message) \ |
|
|
#define STORM_LOG_INFO_COND(cond, message) \ |
|
|
{ \ |
|
|
|
|
|
|
|
|
do { \ |
|
|
if (!(cond)) { \ |
|
|
if (!(cond)) { \ |
|
|
LOG4CPLUS_INFO(logger, message); \ |
|
|
LOG4CPLUS_INFO(logger, message); \ |
|
|
} \ |
|
|
} \ |
|
|
} while (false) \ |
|
|
} while (false) \ |
|
|
|
|
|
|
|
|
#define STORM_LOG_ERROR(message) \ |
|
|
#define STORM_LOG_ERROR(message) \ |
|
|
{ \ |
|
|
|
|
|
|
|
|
do { \ |
|
|
LOG4CPLUS_ERROR(logger, message); \ |
|
|
LOG4CPLUS_ERROR(logger, message); \ |
|
|
} while (false) \ |
|
|
} while (false) \ |
|
|
|
|
|
|
|
|
#define STORM_LOG_ERROR_COND(cond, message) \ |
|
|
#define STORM_LOG_ERROR_COND(cond, message) \ |
|
|
{ \ |
|
|
|
|
|
|
|
|
do { \ |
|
|
if (!(cond)) { \ |
|
|
if (!(cond)) { \ |
|
|
LOG4CPLUS_ERROR(logger, message); \ |
|
|
LOG4CPLUS_ERROR(logger, message); \ |
|
|
} \ |
|
|
} \ |
|
|