helics  3.5.3
Public Member Functions | List of all members
helics::Logger Class Reference

#include <logger.h>

Public Member Functions

 Logger ()
 
 Logger (std::shared_ptr< LoggingCore > core)
 
 ~Logger ()
 
void openFile (const std::string &file)
 
void closeFile ()
 
void startLogging (int cLevel, int fLevel)
 
void startLogging ()
 
void haltLogging ()
 
void log (int level, std::string logMessage)
 
void log (std::string logMessage)
 
void flush ()
 
bool isRunning () const
 
void changeLevels (int cLevel, int fLevel)
 

Detailed Description

class implementing a thread safe Logger

the Logger uses a queuing mechanism and condition variable to store messages to a queue and print/display them in a single thread allowing for asynchronous logging

Constructor & Destructor Documentation

◆ Logger() [1/2]

helics::Logger::Logger ( )

default constructor

◆ Logger() [2/2]

helics::Logger::Logger ( std::shared_ptr< LoggingCore core)
explicit

construct and link to the specified logging Core

◆ ~Logger()

helics::Logger::~Logger ( )

destructor

Member Function Documentation

◆ changeLevels()

void helics::Logger::changeLevels ( int  cLevel,
int  fLevel 
)

alter the printing levels

Parameters
cLevelthe level to print to the console
fLevelthe level to print to the file if it is open

◆ closeFile()

void helics::Logger::closeFile ( )

close the current file for logging

◆ flush()

void helics::Logger::flush ( )

flush the log queue

◆ haltLogging()

void helics::Logger::haltLogging ( )

stop logging for a time, messages received while halted are ignored

◆ isRunning()

bool helics::Logger::isRunning ( ) const

check if the Logger is running

◆ log() [1/2]

void helics::Logger::log ( int  level,
std::string  logMessage 
)

log a message at a particular level

Parameters
levelthe level of the message
logMessagethe actual message to log

◆ log() [2/2]

void helics::Logger::log ( std::string  logMessage)
inline

message to log without regard for levels*

Parameters
logMessagethe message to log

References helics::always_log, and log().

Referenced by log().

◆ openFile()

void helics::Logger::openFile ( const std::string &  file)

open a file to write the log messages

Parameters
filethe name of the file to write messages to

◆ startLogging() [1/2]

void helics::Logger::startLogging ( )
inline

overload of

See also
startLogging with unspecified logging levels

References startLogging().

Referenced by startLogging().

◆ startLogging() [2/2]

void helics::Logger::startLogging ( int  cLevel,
int  fLevel 
)

function to start the logging thread

Parameters
cLevelthe console print level
fLevelthe file print level messages coming in below these levels will be printed

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