26 #include <spdlog/logger.h> 33 inline std::string
AssertMessage(
const char* condition,
const std::string& message,
34 const std::shared_ptr<spdlog::logger>& logger,
const char* file,
int line)
36 std::ostringstream os;
37 os <<
"Assert: '" << condition <<
"'" 38 <<
" fails in: '" << file <<
"' line: " << line <<
" with: " << message;
39 const auto msg = os.str();
41 logger->critical(msg);
44 std::cerr << msg << std::endl;
56 #ifdef STRIDE_INCLUDE_STRIDE_ASSERTS 57 #define AssertLog(CONDITION, MESSAGE, LOGGER) \ 59 stride::util::AssertMessage(#CONDITION, MESSAGE, LOGGER, __FILE__, __LINE__); \ 61 #define AssertThrow(CONDITION, MESSAGE, LOGGER) \ 63 throw stride::util::Exception( \ 64 stride::util::AssertMessage(#CONDITION, MESSAGE, LOGGER, __FILE__, __LINE__)); \ 67 #define AssertLog(CONDITION, MESSAGE, LOGGER) ((void)0) 68 #define AssertThrow(CONDITION, MESSAGE, LOGGER) ((void)0) std::string AssertMessage(const char *condition, const std::string &message, const std::shared_ptr< spdlog::logger > &logger, const char *file, int line)
Namespace for the simulator and related classes.