25#if !defined(MP_CORO_TRACE_LEVEL) || MP_CORO_TRACE_LEVEL == 0
32#include <source_location>
40 std::source_location data;
41 friend std::ostream &operator<<(std::ostream &os,
const location &loc) {
42 os << loc.data.file_name() <<
" (" << loc.data.line() <<
") `" << loc.data.function_name()
50#if MP_CORO_TRACE_LEVEL == 1
52void trace_func(std::source_location loc = std::source_location::current()) {
53 std::osyncstream(std::cout) <<
"[TRACE]: " << detail::location {loc} <<
'\n';
56#define TRACE_FUNC() ::mp_coro::trace_func()
58#elif MP_CORO_TRACE_LEVEL == 2
62struct [[nodiscard]] trace_on_finish {
64 ~trace_on_finish() { std::osyncstream(std::cout) <<
"[TRACE]: " << loc <<
": FINISH\n"; }
69detail::trace_on_finish trace_func(std::source_location loc = std::source_location::current()) {
70 std::osyncstream(std::cout) <<
"[TRACE]: " << detail::location {loc} <<
": START\n";
71 return detail::trace_on_finish {loc};
74#define TRACE_FUNC() auto _ = ::mp_coro::trace_func()