13 constexpr
Size TRACE_SIZE = 10;
14 void* buffer[TRACE_SIZE];
15 const Size nptrs = backtrace(buffer, TRACE_SIZE);
17 char** strings = backtrace_symbols(buffer, nptrs);
19 return {
"No backtrace could be generated!" };
23 for (
Size i = 0; i < nptrs; ++i) {
24 trace.
push(strings[i]);
41 static std::mutex mutex;
42 std::unique_lock<std::mutex> lock(mutex);
47 logger = makeAuto<StringLogger>();
50 logger = makeAuto<StdOutLogger>();
54 "============================================================================================"
58 logger->
write(
"Assert fired in file ", file,
", executing function ", func,
" on line ", line);
59 logger->
write(
"Condition: ", message);
60 if (strlen(text) != 0) {
61 logger->
write(
"Assert parameters: ", text);
64 logger->
write(
"Stack trace:");
66 for (std::string& s : trace) {
80 "============================================================================================"
94 void Assert::todo(
const char* message,
const char* func,
const int line) {
96 logger.
write(
"===========================================================");
97 logger.
write(
"Missing implementation at ", func,
" on line ", line);
98 logger.
write(message);
99 logger.
write(
"===========================================================");
Generic dynamically allocated resizable storage.
uint32_t Size
Integral type used to index arrays (by default).
Logging routines of the run.
#define NAMESPACE_SPH_END
INLINE String toString(const T &value)
INLINE void push(U &&u)
Adds new element to the end of the array, resizing the array if necessary.
void write(TArgs &&... args)
Creates and logs a message by concatenating arguments.
Logger writing messages to string stream.
bool(* Handler)(const std::string &message)
static void fireParams(const char *message, const char *file, const char *func, const int line, const char *params="")
static bool throwAssertException
If true, assert throws an exception.
static Handler handler
Custom assert handler.
static void todo(const char *message, const char *func, const int line)