50 static_assert(std::popcount(to_underlying(Level)) == 1);
51 static_assert(std::is_same_v<
decltype(SourceFile)::value_type,
char>,
"SourceFile must be a basic_fixed_string<char>");
52 static_assert(std::is_same_v<
decltype(Fmt)::value_type,
char>,
"Fmt must be a basic_fixed_string<char>");
55 static constexpr char const *log_level_name =
56 Level == global_state_type::log_fatal ?
"fatal" :
57 Level == global_state_type::log_error ?
"error" :
58 Level == global_state_type::log_warning ?
"warning" :
59 Level == global_state_type::log_info ?
"info" :
60 Level == global_state_type::log_debug ?
"debug" :
61 Level == global_state_type::log_trace ?
"trace" :
62 Level == global_state_type::log_audit ?
"audit" :
63 Level == global_state_type::log_statistics ?
"stats" :
64 "<unknown log level>";
70 template<
typename... Args>
71 tt_force_inline
log_message(Args &&...args) noexcept :
79 ttlet sys_time_point = std::chrono::clock_cast<std::chrono::system_clock>(utc_time_point);
80 ttlet local_time_point = zone->to_local(sys_time_point);
82 ttlet cpu_id = _time_stamp.
cpu_id();
83 ttlet thread_id = _time_stamp.
thread_id();
85 if constexpr (to_bool(Level & global_state_type::log_statistics)) {
86 return std::format(
"{} {:2}:{:<10} {:5} {}\n", local_time_point, cpu_id, thread_id, log_level_name, _what());
89 "{} {:2}:{:<10} {:5} {} ({}:{})\n",
95 URL::urlFromPath(SourceFile).filename(),
102 return std::make_unique<log_message>(*
this);