Main class of the real-time logger.
More...
#include <dynamic-graph/real-time-logger.h>
Main class of the real-time logger.
It is intended to be used like this:
#define ENABLE_RT_LOG
int main (int argc, char** argv) {
}
dgRTLOG() <<
"your message. Prefer to use \n than std::endl." - Note
- Thread safety. This class expects to have:
- only one reader: the one who take the log entries and write them somewhere.
- one writer at a time. Writing to the logs is never a blocking operation. If the resource is busy, the log entry is discarded.
dynamicgraph::RealTimeLogger::RealTimeLogger |
( |
const std::size_t & |
bufferSize | ) |
|
- Todo:
- add an argument to preallocate the internal string to a given size.
dynamicgraph::RealTimeLogger::~RealTimeLogger |
( |
| ) |
|
void dynamicgraph::RealTimeLogger::clearOutputStreams |
( |
| ) |
|
|
inline |
static void dynamicgraph::RealTimeLogger::destroy |
( |
| ) |
|
|
static |
bool dynamicgraph::RealTimeLogger::empty |
( |
| ) |
const |
|
inline |
RTLoggerStream dynamicgraph::RealTimeLogger::front |
( |
| ) |
|
Return an object onto which a real-time thread can write.
The message is considered finished when the object is destroyed.
void dynamicgraph::RealTimeLogger::frontReady |
( |
| ) |
|
|
inline |
bool dynamicgraph::RealTimeLogger::full |
( |
| ) |
const |
|
inline |
std::size_t dynamicgraph::RealTimeLogger::getBufferSize |
( |
| ) |
|
|
inline |
std::size_t dynamicgraph::RealTimeLogger::size |
( |
| ) |
const |
|
inline |
bool dynamicgraph::RealTimeLogger::spinOnce |
( |
| ) |
|
Write next message to output.
It does nothing if the buffer is empty.
- Returns
- true if it wrote something