8#ifndef CPPTRAIL_MESSAGE_H
9#define CPPTRAIL_MESSAGE_H
15#if __cplusplus >= 201703L
26 template<
typename char_t>
58#if __cplusplus >= 202002L
75 template<
typename char_t>
95 std::shared_ptr<impl_type> pImpl
96 ) : m_sLevel(std::move(sLevel)),
97 m_pImpl(std::move(pImpl)) {
113 return this->m_pImpl->stealString();
122 return std::move(this->m_sLevel);
130 return this->m_pImpl;
137 std::shared_ptr<impl_type> m_pImpl;
151#if __cplusplus >= 202002L
168 template<
typename char_t>
180#if __cplusplus >= 201703L
196 std::make_shared<Impl>(std::move(sMessage))
200#if __cplusplus >= 201703L
223 template<
typename T = char_t,
224 typename std::enable_if<std::is_same<T, char>::value,
int>::type = 0>
227 const std::exception &oMessage
230 std::make_shared<Impl>(oMessage.what())
245 : m_sString(std::move(sString)) {
254 return std::move(this->m_sString);
274#if __cplusplus >= 202002L
Abstract base class for message implementations.
Definition message.h:27
std::basic_string< char_type > string_type
Alias for the basic_string type associated with this logger's encoding.
Definition message.h:33
char_t char_type
Alias for the underlying character type.
Definition message.h:30
virtual string_type stealString()=0
Returns the string message to log.
Container for log message implementations.
Definition message.h:76
char_t char_type
Alias for the underlying character type.
Definition message.h:82
BasicMessage()=default
Default constructor.
std::weak_ptr< impl_type > getImplementation() noexcept
Retrieves a weak pointer to the internal implementation.
Definition message.h:129
string_type stealLevel() noexcept
Extracts the string representation of the log level.
Definition message.h:121
BasicMessage(string_type sLevel, std::shared_ptr< impl_type > pImpl)
Internal constructor for derived message types.
Definition message.h:93
string_type stealString()
Returns the string message to log.
Definition message.h:111
std::basic_string< char_type > string_type
Alias for the basic_string type associated with this logger's encoding.
Definition message.h:85
A standard string-based log message.
Definition message.h:169
BasicStringMessage(string_type sLevel, string_type sMessage)
Constructs a message from a string and a level.
Definition message.h:191
char_t char_type
Alias for the underlying character type.
Definition message.h:175
BasicStringMessage(string_type sLevel, string_view_type sMessage)
Constructs a message from a string view and a level.
Definition message.h:206
std::basic_string< char_type > string_type
Alias for the basic_string type associated with this logger's encoding.
Definition message.h:178
BasicStringMessage(string_type sLevel, const std::exception &oMessage)
Constructs a message from a standard exception and a level.
Definition message.h:225
std::basic_string_view< char_type > string_view_type
Alias for the basic_string_view type associated with this logger's encoding.
Definition message.h:182
Global definitions, enumerations, and string mapping utilities for CppTrail.
Root namespace for the CppTrail logging library.
Definition async_logger.h:24