PcapPlusPlus  Next
pcpp::internal::LogContext Class Reference

A context encapsulating the details of a single log message to be passed to the Logger. More...

#include <Logger.h>

Public Member Functions

 LogContext ()=default
 Creates a context with an empty message with Info level and no source.
 
 LogContext (LogLevel level, LogSource const &source={})
 Creates a context with an empty message with the given level and source. More...
 
void init (LogLevel level, LogSource const &source)
 Initializes the context with an empty message and the given level and source. More...
 
template<class T >
LogContextoperator<< (T const &value)
 Appends to the message. More...
 

Friends

class pcpp::Logger
 

Detailed Description

A context encapsulating the details of a single log message to be passed to the Logger.

Constructor & Destructor Documentation

◆ LogContext()

pcpp::internal::LogContext::LogContext ( LogLevel  level,
LogSource const &  source = {} 
)
inlineexplicit

Creates a context with an empty message with the given level and source.

Parameters
levelThe log level for this message.
sourceThe log source.

Member Function Documentation

◆ init()

void pcpp::internal::LogContext::init ( LogLevel  level,
LogSource const &  source 
)
inline

Initializes the context with an empty message and the given level and source.

Parameters
levelThe log level for this message.
sourceThe log source.

◆ operator<<()

template<class T >
LogContext& pcpp::internal::LogContext::operator<< ( T const &  value)
inline

Appends to the message.

Parameters
valueThe value to append.
Returns
A reference to this context.