3#include <boost/log/core/core.hpp>
8#ifndef CLIO_WITHOUT_STACKTRACE
9#include <boost/stacktrace.hpp>
10#include <boost/stacktrace/stacktrace.hpp>
12#include <fmt/format.h>
20 using ActionType = std::function<void(std::string_view)>;
23 static ActionType action;
27 call(std::string_view message);
30 setAction(ActionType newAction);
37 defaultAction(std::string_view message);
51template <
typename... Args>
54 std::source_location
const location,
55 char const* expression,
57 fmt::format_string<Args...> format,
62#ifndef CLIO_WITHOUT_STACKTRACE
63 auto const resultMessage = fmt::format(
64 "Assertion '{}' failed at {}:{}:\n{}\nStacktrace:\n{}",
68 fmt::format(format, std::forward<Args>(args)...),
69 boost::stacktrace::to_string(boost::stacktrace::stacktrace())
72 auto const resultMessage = fmt::format(
73 "Assertion '{}' failed at {}:{}:\n{}",
77 fmt::format(format, std::forward<Args>(args)...)
81 OnAssert::call(resultMessage);
87#define ASSERT(condition, ...) \
88 util::impl::assertImpl( \
89 std::source_location::current(), #condition, static_cast<bool>(condition), __VA_ARGS__ \