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

Container for log message implementations. More...

#include <message.h>

Inheritance diagram for CppTrail::BasicMessage< 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.
 

Public Member Functions

 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.
 

Protected Member Functions

 BasicMessage (string_type sLevel, std::shared_ptr< impl_type > pImpl)
 Internal constructor for derived message types.
 

Detailed Description

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

Container for log message implementations.

Template Parameters
char_tThe character type.

Constructor & Destructor Documentation

◆ BasicMessage()

template<typename char_t >
CppTrail::BasicMessage< char_t >::BasicMessage ( string_type  sLevel,
std::shared_ptr< impl_type pImpl 
)
inlineexplicitprotected

Internal constructor for derived message types.

Parameters
sLevelThe string representation of the log level (e.g., "INFO", "ERROR").
pImplShared pointer to the concrete implementation that manages the message data.

Member Function Documentation

◆ getImplementation()

template<typename char_t >
std::weak_ptr< impl_type > CppTrail::BasicMessage< char_t >::getImplementation ( )
inlinenoexcept

Retrieves a weak pointer to the internal implementation.

Returns
A weak_ptr to the implementation.

◆ stealLevel()

template<typename char_t >
string_type CppTrail::BasicMessage< char_t >::stealLevel ( )
inlinenoexcept

Extracts the string representation of the log level.

Returns
The log level name as a string.
Note
This operation uses move semantics; the internal level string will be empty after this call.

◆ stealString()

template<typename char_t >
string_type CppTrail::BasicMessage< char_t >::stealString ( )
inline

Returns the string message to log.

Returns
The message string.
Note
The implementations enters a non defined state.

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