Miind
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
MPILib::utilities::Log Class Reference

#include <libs/MPILib/include/utilities/Log.hpp>

Collaboration diagram for MPILib::utilities::Log:
Collaboration graph

Public Member Functions

 Log ()=default
 
 Log (const Log &)=delete
 
virtual ~Log ()
 
Logoperator= (const Log &)=delete
 
std::ostringstream & writeReport (LogLevel level=logINFO)
 

Static Public Member Functions

static LogLevel getReportingLevel ()
 
static std::shared_ptr< std::ostream > getStream ()
 
static void setReportingLevel (LogLevel level)
 
static void setStream (std::shared_ptr< std::ostream > pStream)
 

Static Private Member Functions

static void writeOutput (const std::string &msg)
 

Private Attributes

std::ostringstream _buffer
 

Static Private Attributes

static std::shared_ptr< std::ostream > _pStream
 
static LogLevel _reportingLevel = DEBUGLEVEL
 

Detailed Description

class for logging reports. The usage of this log class is described on page The Log utilities provided by miind

Definition at line 141 of file Log.hpp.

Constructor & Destructor Documentation

MPILib::utilities::Log::Log ( )
default

default constructor

MPILib::utilities::Log::Log ( const Log )
delete

copy constructor deleted

MPILib::utilities::Log::~Log ( )
virtual

destructor which writes the message to the stream

Definition at line 128 of file Log.cpp.

References _buffer, and writeOutput().

Member Function Documentation

LogLevel MPILib::utilities::Log::getReportingLevel ( )
static

getter for the current report level

Returns
the current report level

Definition at line 124 of file Log.cpp.

References _reportingLevel.

std::shared_ptr< std::ostream > MPILib::utilities::Log::getStream ( )
static

The Stream it writes to the standard is std::cerr

Returns
The Stream it writes to

Definition at line 83 of file Log.cpp.

References _pStream.

Referenced by writeOutput().

Log& MPILib::utilities::Log::operator= ( const Log )
delete

copy operator deleted

void MPILib::utilities::Log::setReportingLevel ( LogLevel  level)
static

setter for the report level

Parameters
levelThe new report level

Definition at line 117 of file Log.cpp.

References _reportingLevel, LOG, MPILib::utilities::logINFO, and MPILib::utilities::anonymous_namespace{Log.cpp}::logLevelToString().

void MPILib::utilities::Log::setStream ( std::shared_ptr< std::ostream >  pStream)
static

Setter for the stream

Parameters
pStreamThe Stream the log class should print to.

Definition at line 87 of file Log.cpp.

References _pStream.

Referenced by MPILib::MPINetwork< WeightValue, NodeDistribution >::initializeLogStream().

void MPILib::utilities::Log::writeOutput ( const std::string &  msg)
staticprivate

writes the output to the stream

Parameters
msgThe message written to the stream

Definition at line 91 of file Log.cpp.

References getStream().

Referenced by ~Log().

std::ostringstream & MPILib::utilities::Log::writeReport ( LogLevel  level = logINFO)

takes the log message and stores it in the buffer

Parameters
levelThe level of the log message
Returns
a ostringstream

Definition at line 100 of file Log.cpp.

References _buffer, MPILib::utilities::MPIProxy_::getRank(), MPILib::utilities::MPIProxy_::getSize(), MPILib::utilities::anonymous_namespace{Log.cpp}::logLevelToString(), and MPILib::utilities::MPIProxy().

Member Data Documentation

std::ostringstream MPILib::utilities::Log::_buffer
private

The buffer for the log message

Definition at line 213 of file Log.hpp.

Referenced by writeReport(), and ~Log().

std::shared_ptr<std::ostream> MPILib::utilities::Log::_pStream
staticprivate

pointer to the stream

Definition at line 209 of file Log.hpp.

Referenced by getStream(), and setStream().

LogLevel MPILib::utilities::Log::_reportingLevel = DEBUGLEVEL
staticprivate

The current reporting level of the Log, all messages with a level below this level are printed the rest is ignored

The default log level is set to the compile flag DEBUGLEVEL.

Definition at line 204 of file Log.hpp.

Referenced by getReportingLevel(), and setReportingLevel().


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