add Chapter18

This commit is contained in:
Amar Mahmutbegovic
2025-02-06 00:19:59 +01:00
parent 9cc9cc7d73
commit 8634accda5
1533 changed files with 1092521 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
#pragma once
#include <log/log.hpp>
#include <stdx/ct_string.hpp>
#include <type_traits>
namespace flow {
struct default_log_spec {
using flavor = logging::default_flavor_t;
constexpr static auto level = logging::level::TRACE;
};
template <stdx::ct_string, typename...>
constexpr auto log_spec = default_log_spec{};
template <stdx::ct_string Name> struct log_spec_id_t {
constexpr static auto ct_name = Name;
};
template <typename T, typename Fallback = log_spec_id_t<"default">,
typename... DummyArgs>
requires(sizeof...(DummyArgs) == 0)
constexpr static auto get_log_spec() {
using log_spec_t = decltype(log_spec<T::ct_name, DummyArgs...>);
if constexpr (std::is_same_v<log_spec_t, default_log_spec const>) {
if constexpr (Fallback::ct_name == stdx::ct_string{"default"}) {
return log_spec<Fallback::ct_name, DummyArgs...>;
} else {
return get_log_spec<Fallback>();
}
} else {
return log_spec_t{};
}
}
} // namespace flow