|
4 | 4 | #include <log/flavor.hpp> |
5 | 5 | #include <log/level.hpp> |
6 | 6 | #include <log/module.hpp> |
7 | | -#include <log/pp_map.hpp> |
8 | 7 |
|
9 | 8 | #include <stdx/compiler.hpp> |
10 | 9 | #include <stdx/ct_format.hpp> |
11 | 10 | #include <stdx/ct_string.hpp> |
12 | 11 | #include <stdx/panic.hpp> |
| 12 | +#include <stdx/pp_map.hpp> |
13 | 13 | #if __cpp_pack_indexing < 202311L |
14 | 14 | #include <stdx/tuple.hpp> |
15 | 15 | #endif |
@@ -74,32 +74,13 @@ template <stdx::ct_string Msg> constexpr auto cx_log_wrap(int, auto &&...args) { |
74 | 74 |
|
75 | 75 | // NOLINTBEGIN(cppcoreguidelines-macro-usage) |
76 | 76 |
|
77 | | -#define CIB_CX_WRAP1(X) \ |
78 | | - [&](auto f) { \ |
79 | | - if constexpr (::logging::detail::is_already_ct<decltype(f())>) { \ |
80 | | - return f(); \ |
81 | | - } else if constexpr (requires { \ |
82 | | - stdx::ct<[&]() constexpr { return X; }()>; \ |
83 | | - }) { \ |
84 | | - return stdx::ct<f()>(); \ |
85 | | - } else { \ |
86 | | - return f(); \ |
87 | | - } \ |
88 | | - }([&] { return X; }) |
89 | | - |
90 | | -#define CIB_CX_WRAP(...) __VA_OPT__(, CIB_CX_WRAP1(__VA_ARGS__)) |
91 | | - |
92 | | -#define CIB_LOG(MSG, ...) \ |
93 | | - logging::log<cib_log_env_t>(__FILE__, __LINE__, \ |
94 | | - logging::detail::cx_log_wrap<MSG>( \ |
95 | | - 0 CIB_MAP(CIB_CX_WRAP, __VA_ARGS__))) |
96 | | - |
97 | | -#define CIB_LOG_WITH_LEVEL(LEVEL, MSG, ...) \ |
| 77 | +#define CIB_LOG(...) \ |
| 78 | + logging::log<cib_log_env_t>(__FILE__, __LINE__, STDX_CT_FORMAT(__VA_ARGS__)) |
| 79 | + |
| 80 | +#define CIB_LOG_WITH_LEVEL(LEVEL, ...) \ |
98 | 81 | logging::log< \ |
99 | 82 | stdx::extend_env_t<cib_log_env_t, logging::get_level, LEVEL>>( \ |
100 | | - __FILE__, __LINE__, \ |
101 | | - logging::detail::cx_log_wrap<MSG>( \ |
102 | | - 0 CIB_MAP(CIB_CX_WRAP, __VA_ARGS__))) |
| 83 | + __FILE__, __LINE__, STDX_CT_FORMAT(__VA_ARGS__)) |
103 | 84 |
|
104 | 85 | #define CIB_TRACE(...) \ |
105 | 86 | CIB_LOG_WITH_LEVEL(logging::level::TRACE __VA_OPT__(, ) __VA_ARGS__) |
@@ -160,7 +141,7 @@ template <stdx::ct_string Fmt, typename Env, typename F, typename L> |
160 | 141 |
|
161 | 142 | #define CIB_FATAL(MSG, ...) \ |
162 | 143 | logging::detail::panic<MSG, cib_log_env_t>( \ |
163 | | - __FILE__, __LINE__ CIB_MAP(CIB_CX_WRAP, __VA_ARGS__)) |
| 144 | + __FILE__, __LINE__ __VA_OPT__(, STDX_MAP(CX_WRAP, __VA_ARGS__))) |
164 | 145 |
|
165 | 146 | #define CIB_ASSERT(expr, ...) \ |
166 | 147 | ((expr) \ |
|
0 commit comments