rtop
Public Member Functions | Private Attributes | Friends | List of all members
logSpacer Class Reference

enables indentation of logs for easy viewing More...

#include <rtop_logger.h>

Public Member Functions

void addSpace ()
 adds one white-space to white-space string corresponding to invoking thread More...
 
void delSpace ()
 deletes one white-space from white-space string corresponding to invoking thread More...
 
std::string spacer ()
 returns white-space string corresponding to invoking thread More...
 

Private Attributes

std::mutex lgmutex
 
std::map< std::thread::id, std::string > spacers
 

Friends

std::ostream & operator<< (std::ostream &ofs, logSpacer &lgSpacer)
 pushes white-space string corresponding to invoking thread to std::ostream More...
 

Detailed Description

enables indentation of logs for easy viewing

developer can pass this object to BOOST log stream and it will add appropriate space (corresponing to invoking thread) to the stream. This class has methods for adding/deleting white spaces for each thread.
Note: many member methods are under mutex control as a precaution - mutex use is not backed by solid scenario. Methods do access a common container spacers, but it is not clear whether any data-races are generated because of that.

Definition at line 118 of file rtop_logger.h.

Member Function Documentation

◆ addSpace()

void logSpacer::addSpace ( )

adds one white-space to white-space string corresponding to invoking thread

function body is under mutex control.

Definition at line 135 of file rtop_logger.h.

◆ delSpace()

void logSpacer::delSpace ( )

deletes one white-space from white-space string corresponding to invoking thread

function body is under mutex control

Definition at line 151 of file rtop_logger.h.

◆ spacer()

std::string logSpacer::spacer ( )

returns white-space string corresponding to invoking thread

Definition at line 165 of file rtop_logger.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  ofs,
logSpacer lgSpacer 
)
friend

pushes white-space string corresponding to invoking thread to std::ostream

function body is under mutex control

Definition at line 179 of file rtop_logger.h.

Member Data Documentation

◆ lgmutex

std::mutex logSpacer::lgmutex
private

Definition at line 121 of file rtop_logger.h.

◆ spacers

std::map<std::thread::id, std::string> logSpacer::spacers
private

Definition at line 122 of file rtop_logger.h.


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