44#include < log/flavor.hpp>
55#include < log/level.hpp>
66#include < log/module.hpp>
7- #include < sc/format.hpp>
8- #include < sc/fwd.hpp>
97
108#include < stdx/compiler.hpp>
9+ #include < stdx/ct_format.hpp>
1110#include < stdx/ct_string.hpp>
1211#include < stdx/panic.hpp>
1312#include < stdx/type_traits.hpp>
@@ -58,13 +57,13 @@ static auto log(TArgs &&...args) -> void {
5857// NOLINTBEGIN(cppcoreguidelines-macro-usage)
5958
6059#define CIB_LOG (MSG, ...) \
61- logging::log<cib_log_env_t >( \
62- __FILE__, __LINE__, sc::format( MSG##_sc __VA_OPT__ (, ) __VA_ARGS__))
60+ logging::log<cib_log_env_t >(__FILE__, __LINE__, \
61+ stdx::ct_format< MSG>( __VA_ARGS__))
6362
6463#define CIB_LOG_WITH_LEVEL (LEVEL, MSG, ...) \
6564 logging::log< \
6665 stdx::extend_env_t <cib_log_env_t , logging::get_level, LEVEL>>( \
67- __FILE__, __LINE__, sc::format( MSG##_sc __VA_OPT__ (, ) __VA_ARGS__))
66+ __FILE__, __LINE__, stdx::ct_format< MSG>( __VA_ARGS__))
6867
6968#define CIB_TRACE (...) \
7069 CIB_LOG_WITH_LEVEL (logging::level::TRACE __VA_OPT__ (, ) __VA_ARGS__)
@@ -76,14 +75,13 @@ static auto log(TArgs &&...args) -> void {
7675 CIB_LOG_WITH_LEVEL (logging::level::ERROR __VA_OPT__ (, ) __VA_ARGS__)
7776
7877#define CIB_FATAL (MSG, ...) \
79- [](auto &&str ) { \
78+ [](auto &&s ) { \
8079 CIB_LOG_ENV (logging::get_level, logging::level::FATAL); \
81- logging::log<cib_log_env_t >(__FILE__, __LINE__, str); \
82- FWD (str).apply ([]<typename S, typename ... Args>(S s, Args... args) { \
83- constexpr auto cts = stdx::ct_string_from_type (s); \
84- stdx::panic<cts>(args...); \
80+ logging::log<cib_log_env_t >(__FILE__, __LINE__, s); \
81+ FWD (s).args .apply ([](auto &&...args ) { \
82+ stdx::panic<decltype (s.str )::value>(FWD (args)...); \
8583 }); \
86- }(sc::format( MSG##_sc __VA_OPT__ (, ) __VA_ARGS__))
84+ }(stdx::ct_format< MSG>( __VA_ARGS__))
8785
8886#define CIB_ASSERT (expr ) \
8987 ((expr) ? void(0 ) : CIB_FATAL(" Assertion failure: " #expr))
@@ -102,9 +100,8 @@ template <typename Env, typename... Ts> static auto log_version() -> void {
102100 CIB_LOG_ENV (logging::get_level, logging::level::MAX);
103101 l_cfg.logger .template log <cib_log_env_t >(
104102 " " , 0 ,
105- sc::format (" Version: {} ({})" _sc, sc::uint_<v_cfg.build_id >,
106- stdx::ct_string_to_type<v_cfg.version_string ,
107- sc::string_constant>()));
103+ stdx::ct_format<" Version: {} ({})" >(
104+ CX_VALUE (v_cfg.build_id ), CX_VALUE (v_cfg.version_string )));
108105 }
109106}
110107} // namespace logging
0 commit comments