Elements  6.2
A C++ base framework for the Euclid Software.
Public Member Functions | Private Types | Private Attributes | List of all members
Elements::Logging::LogMessageStream Class Reference

A helper class for logging messages using the "<<" operator. More...

Collaboration diagram for Elements::Logging::LogMessageStream:
Collaboration graph
[legend]

Public Member Functions

 LogMessageStream (log4cpp::Category &logger, P_log_func log_func)
 
 LogMessageStream (LogMessageStream &&other)
 
 LogMessageStream (const LogMessageStream &other)
 
 ~LogMessageStream ()
 
template<typename T >
LogMessageStreamoperator<< (const T &m)
 

Private Types

using P_log_func = void(log4cpp::Category::*)(const std::string &)
 

Private Attributes

log4cpp::Category & m_logger
 
P_log_func m_log_func
 
std::stringstream m_message {}
 

Detailed Description

A helper class for logging messages using the "<<" operator.

Each instance of the LogMessageStream class is used for logging one single message. It keeps a reference of the logger to use and a pointer of the related function (to allow different logging levels). The message is logged during the destruction of the object. Instances can only be retrieved by using the Elements::Logging::debug, Elements::Logging::info, etc methods.

Definition at line 309 of file Logging.h.

Member Typedef Documentation

◆ P_log_func

using Elements::Logging::LogMessageStream::P_log_func = void (log4cpp::Category::*)(const std::string&)
private

Definition at line 313 of file Logging.h.

Constructor & Destructor Documentation

◆ LogMessageStream() [1/3]

Elements::Logging::LogMessageStream::LogMessageStream ( log4cpp::Category &  logger,
P_log_func  log_func 
)

◆ LogMessageStream() [2/3]

Doxygen_Suppress Elements::Logging::LogMessageStream::LogMessageStream ( LogMessageStream &&  other)

Definition at line 103 of file Logging.cpp.

◆ LogMessageStream() [3/3]

Elements::Logging::LogMessageStream::LogMessageStream ( const LogMessageStream other)

Definition at line 106 of file Logging.cpp.

References m_log_func.

◆ ~LogMessageStream()

Elements::Logging::LogMessageStream::~LogMessageStream ( )

Definition at line 109 of file Logging.cpp.

Member Function Documentation

◆ operator<<()

template<typename T >
LogMessageStream& Elements::Logging::LogMessageStream::operator<< ( const T &  m)
inline

Definition at line 321 of file Logging.h.

References Elements::Kernel::Units::m.

Member Data Documentation

◆ m_log_func

P_log_func Elements::Logging::LogMessageStream::m_log_func
private

Definition at line 328 of file Logging.h.

Referenced by LogMessageStream().

◆ m_logger

log4cpp::Category& Elements::Logging::LogMessageStream::m_logger
private

Definition at line 327 of file Logging.h.

◆ m_message

std::stringstream Elements::Logging::LogMessageStream::m_message {}
private

Definition at line 329 of file Logging.h.


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