You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
967 B
31 lines
967 B
#ifndef STORM_EXCEPTIONS_EXCEPTIONMACROS_H_
|
|
#define STORM_EXCEPTIONS_EXCEPTIONMACROS_H_
|
|
|
|
#include <cassert>
|
|
|
|
#include "log4cplus/logger.h"
|
|
#include "log4cplus/loggingmacros.h"
|
|
|
|
extern log4cplus::Logger logger;
|
|
|
|
#ifndef NDEBUG
|
|
#define LOG_ASSERT(cond, message) \
|
|
{ \
|
|
if (!(cond)) { \
|
|
LOG4CPLUS_ERROR(logger, message); \
|
|
assert(cond); \
|
|
} \
|
|
} while (false)
|
|
#else
|
|
#define LOG_ASSERT(cond, message) /* empty */
|
|
#endif
|
|
|
|
#define LOG_THROW(cond, exception, message) \
|
|
{ \
|
|
if (!(cond)) { \
|
|
LOG4CPLUS_ERROR(logger, message); \
|
|
throw exception() << message; \
|
|
} \
|
|
} while (false)
|
|
|
|
#endif /* STORM_EXCEPTIONS_EXCEPTIONMACROS_H_ */
|