ZeroErr
zeroerr::LogIterator Class Reference

LogIterator is a class to iterate the log messages. More...

#include <log.h>

Collaboration diagram for zeroerr::LogIterator:

Public Member Functions

 LogIterator ()
 
 LogIterator (LogStream &stream, std::string message="", std::string function_name="", int line=-1)
 
 LogIterator (const LogIterator &rhs)
 
LogIteratoroperator= (const LogIterator &rhs)
 
LogIteratoroperator++ ()
 
LogIterator operator++ (int)
 
template<typename T >
get (std::string name)
 
bool operator== (const LogIterator &rhs) const
 
bool operator!= (const LogIterator &rhs) const
 
LogMessageget () const
 
LogMessageoperator* () const
 
LogMessageoperator-> () const
 
void check_at_safe_pos ()
 

Protected Member Functions

bool check_filter ()
 
void next ()
 

Protected Attributes

DataBlockp
 
LogMessageq
 
std::string function_name_filter
 
std::string message_filter
 
int line_filter = -1
 

Friends

class LogStream
 

Detailed Description

LogIterator is a class to iterate the log messages.

LogIterator is a class to iterate the log messages. You can also filter the log messages by message, function name, and line number.

An example of using LogIterator: for (int i = 0; i < 10; ++i) log("i = {i}", i);

LogIterator it = LogStream::getDefault().begin("Hello, world!"); LogIterator end = LogStream::getDefault().end();

for (; it != end; ++it) { LogMessage& msg = *it; std::cout << msg.str() << std::endl; // "i = {i}" std::cout << it.get<int>("i") << std::endl; // "0", "1", "2", ... }

Constructor & Destructor Documentation

◆ LogIterator() [1/3]

zeroerr::LogIterator::LogIterator ( )
inline

◆ LogIterator() [2/3]

zeroerr::LogIterator::LogIterator ( LogStream stream,
std::string  message = "",
std::string  function_name = "",
int  line = -1 
)

◆ LogIterator() [3/3]

zeroerr::LogIterator::LogIterator ( const LogIterator rhs)
inline

Member Function Documentation

◆ check_at_safe_pos()

void zeroerr::LogIterator::check_at_safe_pos ( )

◆ check_filter()

bool zeroerr::LogIterator::check_filter ( )
protected

◆ get() [1/2]

LogMessage& zeroerr::LogIterator::get ( ) const
inline

◆ get() [2/2]

template<typename T >
T zeroerr::LogIterator::get ( std::string  name)
inline

◆ next()

void zeroerr::LogIterator::next ( )
protected

◆ operator!=()

bool zeroerr::LogIterator::operator!= ( const LogIterator rhs) const
inline

◆ operator*()

LogMessage& zeroerr::LogIterator::operator* ( ) const
inline

◆ operator++() [1/2]

LogIterator & zeroerr::LogIterator::operator++ ( )

◆ operator++() [2/2]

LogIterator zeroerr::LogIterator::operator++ ( int  )
inline

◆ operator->()

LogMessage* zeroerr::LogIterator::operator-> ( ) const
inline

◆ operator=()

LogIterator& zeroerr::LogIterator::operator= ( const LogIterator rhs)
inline

◆ operator==()

bool zeroerr::LogIterator::operator== ( const LogIterator rhs) const
inline

Friends And Related Function Documentation

◆ LogStream

friend class LogStream
friend

Member Data Documentation

◆ function_name_filter

std::string zeroerr::LogIterator::function_name_filter
protected

◆ line_filter

int zeroerr::LogIterator::line_filter = -1
protected

◆ message_filter

std::string zeroerr::LogIterator::message_filter
protected

◆ p

DataBlock* zeroerr::LogIterator::p
protected

◆ q

LogMessage* zeroerr::LogIterator::q
protected

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