DDraceNetwork Docs
CFutureLogger Class Reference

#include <logger.h>

Inheritance diagram for CFutureLogger:
[legend]
Collaboration diagram for CFutureLogger:
[legend]

Public Member Functions

void Set (std::shared_ptr< ILogger > pLogger)
 
void Log (const CLogMessage *pMessage) override
 
void GlobalFinish () override
 
void OnFilterChange () override
 
- Public Member Functions inherited from ILogger
virtual ~ILogger ()
 
void SetFilter (const CLogFilter &Filter)
 
virtual void Log (const CLogMessage *pMessage)=0
 
virtual void GlobalFinish ()
 
virtual void OnFilterChange ()
 

Private Attributes

std::shared_ptr< ILoggerm_pLogger
 
std::vector< CLogMessagem_vPending
 
CLock m_PendingLock
 

Additional Inherited Members

- Protected Attributes inherited from ILogger
CLogFilter m_Filter
 

Detailed Description

Logger that collects log messages in memory until it is replaced by another logger.

Useful when you want to set a global logger without all logging targets being configured.

This logger forwards SetFilter calls, SetFilter calls before a logger is set have no effect.

Member Function Documentation

◆ GlobalFinish()

void CFutureLogger::GlobalFinish ( )
overridevirtual

Flushes output buffers and shuts down. Global loggers cannot be destroyed because they might be accessed from multiple threads concurrently.

This function is called on the global logger by log_global_logger_finish when the program is about to shut down and loggers are supposed to finish writing the log messages they have received so far.

The destructor of this ILogger instance will not be called if this function is called.

See also
log_global_logger_finish

Reimplemented from ILogger.

◆ Log()

void CFutureLogger::Log ( const CLogMessage pMessage)
overridevirtual

Send the specified message to the logging backend.

Parameters
pMessageStruct describing the log message.

Implements ILogger.

◆ OnFilterChange()

void CFutureLogger::OnFilterChange ( )
overridevirtual

Notifies the logger of a changed m_Filter.

Reimplemented from ILogger.

◆ Set()

void CFutureLogger::Set ( std::shared_ptr< ILogger pLogger)

Replace the CFutureLogger instance with the given logger. It'll receive all log messages sent to the CFutureLogger so far.

Member Data Documentation

◆ m_PendingLock

CLock CFutureLogger::m_PendingLock
private

◆ m_pLogger

std::shared_ptr<ILogger> CFutureLogger::m_pLogger
private

◆ m_vPending

std::vector<CLogMessage> CFutureLogger::m_vPending
private

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