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... | |
RTLoggerStream | stream () |
Get an output stream independently of the debug level. More... | |
RTLoggerStream | stream (MsgType type, const std::string &lineId="") |
Print the specified message on standard output if the verbosity level allows it. More... | |
void | sendMsg (std::string msg, MsgType type, const std::string &lineId="") |
void | sendMsg (std::string msg, MsgType type, const std::string &file, int line) DYNAMIC_GRAPH_DEPRECATED |
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 Types | |
typedef std::map< std::string, double > | StreamCounterMap_t |
every time this is < 0 (i.e. every _streamPrintPeriod sec) print stuff More... | |
Protected Member Functions | |
bool | isStreamMsg (MsgType m) |
bool | acceptMsg (MsgType m, const std::string &lineId) |
Check whether a message of type and from lineId should be accepted. More... | |
bool | checkStreamPeriod (const std::string &lineId) |
Check whether a message from lineId should be accepted. More... | |
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... | |
StreamCounterMap_t | m_stream_msg_counters |
Pointer to the dynamic structure which holds the collection of streaming messages. More... | |
Class for logging messages.
It is intended to be used like this:
|
protected |
every time this is < 0 (i.e. every _streamPrintPeriod sec) print stuff
dynamicgraph::Logger::Logger | ( | double | timeSample = 0.001 , |
double | streamPrintPeriod = 1.0 |
||
) |
Constructor.
dynamicgraph::Logger::~Logger | ( | ) |
Destructor.
|
inlineprotected |
Check whether a message of type and from lineId
should be accepted.
is
a stream type, the internal counter associated to lineId
is updated. References checkStreamPeriod(), isStreamMsg(), and dynamicgraph::MSG_TYPE_TYPE_BITS.
Referenced by stream().
|
protected |
Check whether a message from lineId
should be accepted.
lineId
is updated. Referenced by acceptMsg().
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.
Referenced by stream().
double dynamicgraph::Logger::getTimeSample | ( | ) |
Get the sampling time at which the method countdown() is going to be called.
Referenced by stream().
LoggerVerbosity dynamicgraph::Logger::getVerbosity | ( | ) |
Get the verbosity level of the logger.
Referenced by stream().
|
inlineprotected |
References dynamicgraph::MSG_TYPE_STREAM_BIT.
Referenced by acceptMsg().
void dynamicgraph::Logger::sendMsg | ( | std::string | msg, |
MsgType | type, | ||
const std::string & | lineId = "" |
||
) |
void dynamicgraph::Logger::sendMsg | ( | std::string | msg, |
MsgType | type, | ||
const std::string & | file, | ||
int | line | ||
) |
bool dynamicgraph::Logger::setStreamPrintPeriod | ( | double | s | ) |
Set the time period for printing of streaming messages.
Referenced by stream().
bool dynamicgraph::Logger::setTimeSample | ( | double | t | ) |
Set the sampling time at which the method countdown() is going to be called.
Referenced by stream().
void dynamicgraph::Logger::setVerbosity | ( | LoggerVerbosity | lv | ) |
Set the verbosity level of the logger.
Referenced by stream().
|
inline |
Get an output stream independently of the debug level.
|
inline |
Print the specified message on standard output if the verbosity level allows it.
The lineId is used to identify the point where sendMsg is called so that streaming messages are printed only every streamPrintPeriod iterations.
lineId | typically __FILE__ ":" BOOST_PP_STRINGIZE(__LINE__) |
References acceptMsg(), DYNAMIC_GRAPH_DEPRECATED, dynamicgraph::RealTimeLogger::emptyStream(), dynamicgraph::RealTimeLogger::front(), getStreamPrintPeriod(), getTimeSample(), getVerbosity(), dynamicgraph::RealTimeLogger::instance(), sendMsg(), setStreamPrintPeriod(), setTimeSample(), and setVerbosity().
|
protected |
|
protected |
specify the time period of the stream prints
|
protected |
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