CppTrail
Loading...
Searching...
No Matches
CppTrail::BasicStringMessage< char_t > Class Template Reference

A standard string-based log message. More...

#include <message.h>

Inheritance diagram for CppTrail::BasicStringMessage< char_t >:
Collaboration diagram for CppTrail::BasicStringMessage< char_t >:

Public Types

using impl_type = BasicMessageImpl< char_t >
 Alias for the implementation type.
 
using char_type = char_t
 Alias for the underlying character type.
 
using string_type = std::basic_string< char_type >
 Alias for the basic_string type associated with this logger's encoding.
 
using string_view_type = std::basic_string_view< char_type >
 Alias for the basic_string_view type associated with this logger's encoding.
 
- Public Types inherited from CppTrail::BasicMessage< char_t >
using impl_type = BasicMessageImpl< char_t >
 Alias for the implementation type.
 
using char_type = char_t
 Alias for the underlying character type.
 
using string_type = std::basic_string< char_type >
 Alias for the basic_string type associated with this logger's encoding.
 

Public Member Functions

 BasicStringMessage (string_type sLevel, string_type sMessage)
 Constructs a message from a string and a level.
 
 BasicStringMessage (string_type sLevel, string_view_type sMessage)
 Constructs a message from a string view and a level.
 
template<typename T = char_t, typename std::enable_if< std::is_same< T, char >::value, int >::type = 0>
 BasicStringMessage (string_type sLevel, const std::exception &oMessage)
 Constructs a message from a standard exception and a level.
 
- Public Member Functions inherited from CppTrail::BasicMessage< char_t >
 BasicMessage ()=default
 Default constructor.
 
string_type stealString ()
 Returns the string message to log.
 
string_type stealLevel () noexcept
 Extracts the string representation of the log level.
 
std::weak_ptr< impl_typegetImplementation () noexcept
 Retrieves a weak pointer to the internal implementation.
 

Additional Inherited Members

- Protected Member Functions inherited from CppTrail::BasicMessage< char_t >
 BasicMessage (string_type sLevel, std::shared_ptr< impl_type > pImpl)
 Internal constructor for derived message types.
 

Detailed Description

template<typename char_t>
class CppTrail::BasicStringMessage< char_t >

A standard string-based log message.

Template Parameters
char_tThe character type.

Constructor & Destructor Documentation

◆ BasicStringMessage() [1/3]

template<typename char_t >
CppTrail::BasicStringMessage< char_t >::BasicStringMessage ( string_type  sLevel,
string_type  sMessage 
)
inline

Constructs a message from a string and a level.

Parameters
sLevelThe string representation of the log level.
sMessageThe message content to be stored.

◆ BasicStringMessage() [2/3]

template<typename char_t >
CppTrail::BasicStringMessage< char_t >::BasicStringMessage ( string_type  sLevel,
string_view_type  sMessage 
)
inline

Constructs a message from a string view and a level.

Parameters
sLevelThe string representation of the log level.
sMessageThe string view content to copy into the message.

◆ BasicStringMessage() [3/3]

template<typename char_t >
template<typename T = char_t, typename std::enable_if< std::is_same< T, char >::value, int >::type = 0>
CppTrail::BasicStringMessage< char_t >::BasicStringMessage ( string_type  sLevel,
const std::exception &  oMessage 
)
inline

Constructs a message from a standard exception and a level.

Template Parameters
TInternal type for SFINAE check.
Parameters
sLevelThe string representation of the log level.
oMessageThe exception object to extract the message from.
Note
This constructor is only available for char-based messages.

The documentation for this class was generated from the following file: