6 #ifndef SL_LOG_RECORD_HPP
7 #define SL_LOG_RECORD_HPP
15 #ifdef __cpp_lib_source_location
16 #include <source_location>
38 template <
class TRecord>
53 template <
class TRecord>
65 template <
class TRecord>
77 template <
class TRecord>
89 template <
class TRecord>
99 template <
class TRecord>
116 template <
class TRecord>
119 constexpr
static auto message{ [](
auto& record) {
return record.message(); } };
120 constexpr
static auto severity{ [](
auto& record) {
return record.severity(); } };
121 constexpr
static auto channel{ [](
auto& record) {
return record.channel(); } };
122 constexpr
static auto timePoint{ [](
auto& record) {
return record.timePoint(); } };
129 template <
class TRecord>
131 RecordMemberTypedefs<TRecord> &&
132 requires(
const TRecord& rec)
147 template <
class TRecord>
154 []<
class TMessage>(
Record_t& record, TMessage&& msg)
156 return record.setMessage(std::forward<TMessage>(msg));
162 []<
class TSeverity>(
Record_t& record, TSeverity&& sev)
164 return record.setSeverity(std::forward<TSeverity>(sev));
170 []<
class TChannel>(
Record_t& record, TChannel&& chan)
172 return record.setChannel(std::forward<TChannel>(chan));
178 []<
class TTimePoint>(
Record_t& record, TTimePoint&& timePoint)
180 return record.setTimePoint(std::forward<TTimePoint>(timePoint));
189 template <
class TRecord>
191 RecordMemberTypedefs<TRecord> &&
192 requires(TRecord& rec)
203 template <
class TRecord>
205 std::movable<TRecord> &&
206 RecordMemberTypedefs<TRecord> &&
207 RecordMemberGetters<TRecord> &&
208 RecordMemberSetters<TRecord>;
222 template <std::semiregular TSeverityLevel,
223 std::semiregular TChannel,
224 std::semiregular TMessage = std::string,
225 std::semiregular TTimePoint = std::chrono::system_clock::time_point>
233 #ifdef __cpp_lib_source_location
234 using SourceLocation_t = std::remove_cvref_t<std::source_location>;
252 template <std::convertible_to<Message_t> UMessage>
255 m_Message = std::forward<UMessage>(msg);
273 template <std::convertible_to<TimePo
int_t> UTimePo
int>
276 m_TimePoint = std::forward<UTimePoint>(
timePoint);
294 template <std::convertible_to<SeverityLevel_t> USeverityLevel>
297 m_Severity = std::forward<USeverityLevel>(
severity);
315 template <std::convertible_to<Channel_t> UChannel>
318 m_Channel = std::forward<UChannel>(
channel);
321 #ifdef __cpp_lib_source_location
327 const SourceLocation_t& sourceLocation() const noexcept
329 return m_SourceLocation;
333 template <std::convertible_to<SourceLocation_t> USourceLocation>
334 void setChannel(USourceLocation&& sourceLocation)
336 m_SourceLocation = std::forward<USourceLocation>(sourceLocation);
345 #ifdef __cpp_lib_source_location
346 SourceLocation_t m_SourceLocation{};
A collection of logging related information.
Definition: Record.hpp:227
void setChannel(UChannel &&channel)
Sets the Record s severity level.
Definition: Record.hpp:316
const Message_t & message() const noexcept
Const access to the message.
Definition: Record.hpp:242
void setSeverity(USeverityLevel &&severity)
Sets the Record s severity level.
Definition: Record.hpp:295
std::remove_cvref_t< TMessage > Message_t
Definition: Record.hpp:229
const TimePoint_t & timePoint() const noexcept
Const access to the time stamp.
Definition: Record.hpp:263
const Channel_t & channel() const noexcept
Const access to the channel.
Definition: Record.hpp:305
const SeverityLevel_t & severity() const noexcept
Const access to the severity level.
Definition: Record.hpp:284
void setTimePoint(UTimePoint &&timePoint)
Sets the Record s time stamp.
Definition: Record.hpp:274
std::remove_cvref_t< TTimePoint > TimePoint_t
Definition: Record.hpp:232
std::remove_cvref_t< TSeverityLevel > SeverityLevel_t
Definition: Record.hpp:230
void setMessage(UMessage &&msg)
Sets the message string.
Definition: Record.hpp:253
std::remove_cvref_t< TChannel > Channel_t
Definition: Record.hpp:231
typename RecordTypedefs< TRecord >::Message_t RecordMessage_t
Typedef for easier access to Record's message type.
Definition: Record.hpp:57
concept RecordMemberGetters
Concept which checks for the necessary member projections of a Record type.
Definition: Record.hpp:130
typename RecordTypedefs< TRecord >::Severity_t RecordSeverity_t
Typedef for easier access to Record's severity type.
Definition: Record.hpp:69
typename RecordTypedefs< TRecord >::TimePoint_t RecordTimePoint_t
Typedef for easier access to Record's time-point type.
Definition: Record.hpp:93
concept RecordMemberSetters
Concept which checks for the necessary member setters of a Record type.
Definition: Record.hpp:190
concept Record
Concept which all the necessary concepts for Record types.
Definition: Record.hpp:204
concept RecordMemberTypedefs
Concept which checks for the necessary member typedefs of a Record type.
Definition: Record.hpp:100
typename RecordTypedefs< TRecord >::Channel_t RecordChannel_t
Typedef for easier access to Record's channel type.
Definition: Record.hpp:81
Definition: BasicSink.hpp:22
Provides a layer of abstraction to Record member setter.
Definition: Record.hpp:118
constexpr static auto timePoint
Definition: Record.hpp:122
constexpr static auto message
Definition: Record.hpp:119
constexpr static auto channel
Definition: Record.hpp:121
constexpr static auto severity
Definition: Record.hpp:120
Provides a layer of abstraction to Record member setter.
Definition: Record.hpp:149
constexpr static auto setSeverity
Definition: Record.hpp:161
constexpr static auto setMessage
Definition: Record.hpp:153
std::remove_cvref_t< TRecord > Record_t
Definition: Record.hpp:150
constexpr static auto setChannel
Definition: Record.hpp:169
constexpr static auto setTimePoint
Definition: Record.hpp:177
Provides a layer of abstraction to Record member types.
Definition: Record.hpp:40
typename TRecord::SeverityLevel_t Severity_t
Definition: Record.hpp:42
typename TRecord::Channel_t Channel_t
Definition: Record.hpp:43
typename TRecord::TimePoint_t TimePoint_t
Definition: Record.hpp:44
typename TRecord::Message_t Message_t
Definition: Record.hpp:41