1
1
#pragma once
2
2
3
+ #include < log/env.hpp>
3
4
#include < log/level.hpp>
5
+ #include < log/module.hpp>
4
6
#include < sc/format.hpp>
5
7
#include < sc/fwd.hpp>
6
8
@@ -44,37 +46,18 @@ ALWAYS_INLINE constexpr static auto get_config() -> auto & {
44
46
}
45
47
}
46
48
47
- template <typename Flavor, level L, typename ModuleId , typename ... Ts,
49
+ template <typename Flavor, level L, typename Env , typename ... Ts,
48
50
typename ... TArgs>
49
51
ALWAYS_INLINE static auto log (TArgs &&...args) -> void {
50
52
auto &cfg = get_config<Flavor, Ts...>();
51
- cfg.logger .template log <L, ModuleId >(std::forward<TArgs>(args)...);
53
+ cfg.logger .template log <L, Env >(std::forward<TArgs>(args)...);
52
54
}
53
-
54
- template <stdx::ct_string S> struct module_id_t {
55
- using type = decltype (stdx::ct_string_to_type<S, sc::string_constant>());
56
- };
57
55
} // namespace logging
58
56
59
- using cib_log_module_id_t = typename logging::module_id_t <" default" >::type;
60
-
61
57
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
62
58
63
- #ifdef __clang__
64
- #define CIB_PRAGMA_SEMI
65
- #else
66
- #define CIB_PRAGMA_SEMI ;
67
- #endif
68
-
69
- #define CIB_LOG_MODULE (S ) \
70
- STDX_PRAGMA (diagnostic push) \
71
- STDX_PRAGMA(diagnostic ignored " -Wshadow" ) \
72
- using cib_log_module_id_t [[maybe_unused]] = \
73
- typename logging::module_id_t<S>::type CIB_PRAGMA_SEMI STDX_PRAGMA( \
74
- diagnostic pop)
75
-
76
59
#define CIB_LOG (FLAVOR, LEVEL, MSG, ...) \
77
- logging::log<FLAVOR, LEVEL, cib_log_module_id_t >( \
60
+ logging::log<FLAVOR, LEVEL, cib_log_env_t >( \
78
61
__FILE__, __LINE__, sc::format(MSG##_sc __VA_OPT__ (, ) __VA_ARGS__))
79
62
80
63
#define CIB_TRACE (...) \
@@ -90,7 +73,7 @@ using cib_log_module_id_t = typename logging::module_id_t<"default">::type;
90
73
[] { \
91
74
constexpr auto str = sc::format (MSG##_sc __VA_OPT__ (, ) __VA_ARGS__); \
92
75
logging::log<logging::default_flavor_t , logging::level::FATAL, \
93
- cib_log_module_id_t >(__FILE__, __LINE__, str); \
76
+ cib_log_env_t >(__FILE__, __LINE__, str); \
94
77
str.apply ([]<typename S, typename ... Args>(S s, Args... args) { \
95
78
constexpr auto cts = stdx::ct_string_from_type (s); \
96
79
stdx::panic<cts>(args...); \
@@ -111,7 +94,7 @@ ALWAYS_INLINE static auto log_version() -> void {
111
94
}) {
112
95
l_cfg.logger .template log_build <v_cfg.build_id , v_cfg.version_string >();
113
96
} else {
114
- l_cfg.logger .template log <level::MAX, cib_log_module_id_t >(
97
+ l_cfg.logger .template log <level::MAX, cib_log_env_t >(
115
98
" " , 0 ,
116
99
sc::format (" Version: {} ({})" _sc, sc::uint_<v_cfg.build_id >,
117
100
stdx::ct_string_to_type<v_cfg.version_string ,
0 commit comments