Class for logging messages. More...
#include <dynamic-graph/logger.h>
Public Member Functions | |
Logger (double timeSample=0.001, double streamPrintPeriod=1.0) | |
Constructor. More... | |
~Logger () | |
Destructor. More... | |
void | countdown () |
Method to be called at every control iteration to decrement the internal Logger's counter. More... | |
void | sendMsg (std::string msg, MsgType type, const char *file="", int line=0) |
Print the specified message on standard output if the verbosity level allows it. More... | |
bool | setTimeSample (double t) |
Set the sampling time at which the method countdown() is going to be called. More... | |
double | getTimeSample () |
Get the sampling time at which the method countdown() is going to be called. More... | |
bool | setStreamPrintPeriod (double s) |
Set the time period for printing of streaming messages. More... | |
double | getStreamPrintPeriod () |
Get the time period for printing of streaming messages. More... | |
void | setVerbosity (LoggerVerbosity lv) |
Set the verbosity level of the logger. More... | |
LoggerVerbosity | getVerbosity () |
Get the verbosity level of the logger. More... | |
Protected Member Functions | |
bool | isStreamMsg (MsgType m) |
bool | isDebugMsg (MsgType m) |
bool | isInfoMsg (MsgType m) |
bool | isWarningMsg (MsgType m) |
bool | isErrorMsg (MsgType m) |
Protected Attributes | |
LoggerVerbosity | m_lv |
double | m_timeSample |
verbosity of the logger More... | |
double | m_streamPrintPeriod |
specify the period of call of the countdown method More... | |
double | m_printCountdown |
specify the time period of the stream prints More... | |
std::map< std::string, double > | m_stream_msg_counters |
every time this is < 0 (i.e. every _streamPrintPeriod sec) print stuff More... | |
Class for logging messages.
It is intended to be used like this:
dynamicgraph::Logger::Logger | ( | double | timeSample = 0.001 , |
double | streamPrintPeriod = 1.0 |
||
) |
Constructor.
dynamicgraph::Logger::~Logger | ( | ) |
Destructor.
void dynamicgraph::Logger::countdown | ( | ) |
Method to be called at every control iteration to decrement the internal Logger's counter.
double dynamicgraph::Logger::getStreamPrintPeriod | ( | ) |
Get the time period for printing of streaming messages.
double dynamicgraph::Logger::getTimeSample | ( | ) |
Get the sampling time at which the method countdown() is going to be called.
LoggerVerbosity dynamicgraph::Logger::getVerbosity | ( | ) |
Get the verbosity level of the logger.
|
inlineprotected |
References dynamicgraph::MSG_TYPE_DEBUG, and dynamicgraph::MSG_TYPE_DEBUG_STREAM.
|
inlineprotected |
References dynamicgraph::MSG_TYPE_ERROR, and dynamicgraph::MSG_TYPE_ERROR_STREAM.
|
inlineprotected |
References dynamicgraph::MSG_TYPE_INFO, and dynamicgraph::MSG_TYPE_INFO_STREAM.
|
inlineprotected |
|
inlineprotected |
References dynamicgraph::MSG_TYPE_WARNING, and dynamicgraph::MSG_TYPE_WARNING_STREAM.
void dynamicgraph::Logger::sendMsg | ( | std::string | msg, |
MsgType | type, | ||
const char * | file = "" , |
||
int | line = 0 |
||
) |
Print the specified message on standard output if the verbosity level allows it.
The file name and the line number are used to identify the point where sendMsg is called so that streaming messages are printed only every streamPrintPeriod iterations.
bool dynamicgraph::Logger::setStreamPrintPeriod | ( | double | s | ) |
Set the time period for printing of streaming messages.
bool dynamicgraph::Logger::setTimeSample | ( | double | t | ) |
Set the sampling time at which the method countdown() is going to be called.
void dynamicgraph::Logger::setVerbosity | ( | LoggerVerbosity | lv | ) |
Set the verbosity level of the logger.
|
protected |
|
protected |
specify the time period of the stream prints
|
protected |
every time this is < 0 (i.e. every _streamPrintPeriod sec) print stuff
Pointer to the dynamic structure which holds the collection of streaming messages
|
protected |
specify the period of call of the countdown method
|
protected |
verbosity of the logger