Class for logging messages. More...
#include <dynamic-graph/logger.h>
Public Member Functions | |
Logger (double timeSample=0.001, double streamPrintPeriod=1.0) | |
~Logger () | |
void | countdown () |
double | getStreamPrintPeriod () |
double | getTimeSample () |
LoggerVerbosity | getVerbosity () |
void | sendMsg (std::string msg, MsgType type, const std::string &file, int line) |
void | sendMsg (std::string msg, MsgType type, const std::string &lineId="") |
bool | setStreamPrintPeriod (double s) |
bool | setTimeSample (double t) |
void | setVerbosity (LoggerVerbosity lv) |
RTLoggerStream | stream () |
RTLoggerStream | stream (MsgType type, const std::string &lineId="") |
Protected Types | |
typedef std::map< std::string, double > | StreamCounterMap_t |
every time this is < 0 (i.e. every _streamPrintPeriod sec) print stuff | |
Protected Member Functions | |
bool | acceptMsg (MsgType m, const std::string &lineId) |
bool | checkStreamPeriod (const std::string &lineId) |
bool | isStreamMsg (MsgType m) |
Protected Attributes | |
LoggerVerbosity | m_lv |
double | m_printCountdown |
specify the time period of the stream prints | |
StreamCounterMap_t | m_stream_msg_counters |
double | m_streamPrintPeriod |
specify the period of call of the countdown method | |
double | m_timeSample |
verbosity of the logger | |
Class for logging messages.
It is intended to be used like this:
Logger | ( | double | timeSample = 0.001 , |
double | streamPrintPeriod = 1.0 |
||
) |
Constructor
~Logger | ( | ) |
Destructor
|
inlineprotected |
|
protected |
Check whether a message from lineId
should be accepted.
lineId
is updated. void countdown | ( | ) |
Method to be called at every control iteration to decrement the internal Logger's counter.
double getStreamPrintPeriod | ( | ) |
Get the time period for printing of streaming messages.
double getTimeSample | ( | ) |
Get the sampling time at which the method countdown() is going to be called.
LoggerVerbosity getVerbosity | ( | ) |
Get the verbosity level of the logger.
void sendMsg | ( | std::string | msg, |
MsgType | type, | ||
const std::string & | file, | ||
int | line | ||
) |
void sendMsg | ( | std::string | msg, |
MsgType | type, | ||
const std::string & | lineId = "" |
||
) |
bool setStreamPrintPeriod | ( | double | s | ) |
Set the time period for printing of streaming messages.
bool setTimeSample | ( | double | t | ) |
Set the sampling time at which the method countdown() is going to be called.
void setVerbosity | ( | LoggerVerbosity | lv | ) |
Set the verbosity level of the logger.
|
inline |
|
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.
type | specifies the verbosity level, for instance MSG_TYPE_DEBUG |
lineId | typically FILE ":" BOOST_PP_STRINGIZE(LINE) |
|
protected |