Class for logging messages. More...
#include <logger.h>
Public Member Functions | |
void | countdown () |
double | getStreamPrintPeriod () |
double | getTimeSample () |
LoggerVerbosity | getVerbosity () |
Logger (double timeSample=0.001, double streamPrintPeriod=1.0) | |
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="") |
~Logger () | |
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 | 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 More... | |
StreamCounterMap_t | m_stream_msg_counters |
double | m_streamPrintPeriod |
specify the period of call of the countdown method More... | |
double | m_timeSample |
verbosity of the logger More... | |
Class for logging messages.
It is intended to be used like this:
|
protected |
dynamicgraph::Logger::Logger | ( | double | timeSample = 0.001 , |
double | streamPrintPeriod = 1.0 |
||
) |
Constructor
Definition at line 25 of file logger.cpp.
dynamicgraph::Logger::~Logger | ( | ) |
Destructor
Definition at line 32 of file logger.cpp.
|
inlineprotected |
|
protected |
Check whether a message from lineId
should be accepted.
lineId
is updated. Definition at line 69 of file logger.cpp.
void dynamicgraph::Logger::countdown | ( | ) |
Method to be called at every control iteration to decrement the internal Logger's counter.
Definition at line 37 of file logger.cpp.
double dynamicgraph::Logger::getStreamPrintPeriod | ( | ) |
Get the time period for printing of streaming messages.
Definition at line 67 of file logger.cpp.
double dynamicgraph::Logger::getTimeSample | ( | ) |
Get the sampling time at which the method countdown() is going to be called.
Definition at line 65 of file logger.cpp.
LoggerVerbosity dynamicgraph::Logger::getVerbosity | ( | ) |
Get the verbosity level of the logger.
Definition at line 36 of file logger.cpp.
|
inlineprotected |
void dynamicgraph::Logger::sendMsg | ( | std::string | msg, |
MsgType | type, | ||
const std::string & | file, | ||
int | line | ||
) |
Definition at line 46 of file logger.cpp.
void dynamicgraph::Logger::sendMsg | ( | std::string | msg, |
MsgType | type, | ||
const std::string & | lineId = "" |
||
) |
Definition at line 42 of file logger.cpp.
bool dynamicgraph::Logger::setStreamPrintPeriod | ( | double | s | ) |
Set the time period for printing of streaming messages.
Definition at line 59 of file logger.cpp.
bool dynamicgraph::Logger::setTimeSample | ( | double | t | ) |
Set the sampling time at which the method countdown() is going to be called.
Definition at line 53 of file logger.cpp.
void dynamicgraph::Logger::setVerbosity | ( | LoggerVerbosity | lv | ) |
Set the verbosity level of the logger.
Definition at line 34 of file logger.cpp.
|
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 |
|
protected |
|
protected |
|
protected |
|
protected |