CppTrail
Loading...
Searching...
No Matches
CppTrail::BasicLoggerImpl< char_t > Class Template Referenceabstract

Abstract template interface defining the mandatory contract for all loggers. More...

#include <base_logger.h>

Inheritance diagram for CppTrail::BasicLoggerImpl< char_t >:

Public Types

using char_type = char_t
 Alias for the underlying character type used by this logger.
 
using string_type = std::basic_string< char_type >
 Alias for the basic_string type associated with this logger's encoding.
 
using message_type = BasicMessage< char_type >
 Alias for the BasicMessage type associated to the logger.
 
using string_view_type = std::basic_string_view< char_type >
 Alias for the basic_string_view type associated with this logger's encoding.
 

Public Member Functions

virtual ~BasicLoggerImpl ()=default
 Virtual destructor to ensure proper cleanup of derived logger resources.
 
virtual void log (message_type oMessage)=0
 Primary interface for submitting a log record.
 
virtual void start ()=0
 Synchronously starts the logger service.
 
virtual void stop ()=0
 Synchronously stops the logger service.
 
virtual void signalStop ()=0
 Asynchronously signals the logger to initiate a shutdown sequence.
 
virtual void join ()=0
 Waits for the asynchronous end of the shutdown sequence.
 
virtual Status status ()=0
 Retrieves the current operational health and state of the logger.
 

Detailed Description

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

Abstract template interface defining the mandatory contract for all loggers.

This template serves as the foundation for both synchronous and asynchronous implementations. It abstracts the character type to allow native support for multiple encodings (UTF-8, UTF-16, etc.) across different logging sinks.

Template Parameters
char_tThe character type (e.g., char, char8_t, wchar_t) used for log data.
Note
This base interface does not provide internal synchronization; thread-safety depends on the specific derived implementation (e.g., AsyncLoggerImpl).

Member Function Documentation

◆ join()

template<typename char_t >
virtual void CppTrail::BasicLoggerImpl< char_t >::join ( )
pure virtual

Waits for the asynchronous end of the shutdown sequence.

This function is used in conjunction with signalStop() to ensure description safety.

Implemented in CppTrail::BasicAsyncLoggerImpl< char_t >, and CppTrail::BasicSyncLoggerImpl< char_t >.

◆ log()

template<typename char_t >
virtual void CppTrail::BasicLoggerImpl< char_t >::log ( message_type  oMessage)
pure virtual

Primary interface for submitting a log record.

Parameters
oMessageThe message to be processed.

Implemented in CppTrail::BasicAsyncLoggerImpl< char_t >, and CppTrail::BasicSyncLoggerImpl< char_t >.

◆ signalStop()

template<typename char_t >
virtual void CppTrail::BasicLoggerImpl< char_t >::signalStop ( )
pure virtual

Asynchronously signals the logger to initiate a shutdown sequence.

Unlike stop(), this returns immediately, allowing the logger to shut down in the background (typically via a dedicated "killer" thread).

Implemented in CppTrail::BasicAsyncLoggerImpl< char_t >, and CppTrail::BasicSyncLoggerImpl< char_t >.

◆ start()

template<typename char_t >
virtual void CppTrail::BasicLoggerImpl< char_t >::start ( )
pure virtual

Synchronously starts the logger service.

This call blocks the calling thread until the logger's internal status reaches Status::RUNNING.

Implemented in CppTrail::BasicAsyncLoggerImpl< char_t >, and CppTrail::BasicSyncLoggerImpl< char_t >.

◆ status()

template<typename char_t >
virtual Status CppTrail::BasicLoggerImpl< char_t >::status ( )
pure virtual

Retrieves the current operational health and state of the logger.

Returns
The current Status (RUNNING, STOPPED, BROKEN, or TRASCENDENT).

Implemented in CppTrail::BasicAsyncLoggerImpl< char_t >, and CppTrail::BasicSyncLoggerImpl< char_t >.

◆ stop()

template<typename char_t >
virtual void CppTrail::BasicLoggerImpl< char_t >::stop ( )
pure virtual

Synchronously stops the logger service.

This call blocks until all workers are joined and the status reaches Status::STOPPED. Implementation-defined behavior determines if the remaining queue is flushed before exit.

Implemented in CppTrail::BasicAsyncLoggerImpl< char_t >, and CppTrail::BasicSyncLoggerImpl< char_t >.


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