Commit d4af652a authored by Olivier Stasse's avatar Olivier Stasse Committed by olivier stasse
Browse files

[doc] Reorganize the documentation to better explain how to debug entities.

parent 6795adee
...@@ -3,14 +3,15 @@ ...@@ -3,14 +3,15 @@
They are several ways to perform debugging in dynamic-graph depending on your They are several ways to perform debugging in dynamic-graph depending on your
needs or situation: needs or situation:
- Programmatically inside the entity in C++ will write inside a buffer in a - Programmatically inside the entity in C++, a logger will
write inside a buffer in a
different thread and output in a stream (either std::cout or a file). It is different thread and output in a stream (either std::cout or a file). It is
detailed in \subpage subp_debug_rt_logger. detailed in \subpage subp_debug_rt_logger.
- Programmatically inside the entity in C++ using a member of the entities and It provides 4 levels of messags :(DEBUG,INFO,
the previous real-time mechanism. It provides 4 levels of messags :(DEBUG,INFO,
WARNING, ERROR). It is described in details here: \subpage subp_logger WARNING, ERROR). It is described in details here: \subpage subp_logger
- Programmatically in C++ to avoid overhead with macros and handling level as an - Programmatically in C++ to avoid overhead with macros and handling level as an
int: \subpage subp_dbg_trace int: \subpage subp_dbg_trace .
- If you just need to collect informations from signals (like rosbag). You can - If you just need to collect informations from signals (like rosbag). You can
use an entity called Tracer inside the graph:\subpage tracerdoc . <br> A real use an entity called Tracer inside the graph:\subpage tracerdoc . <br> A real
time version exists to write directly inside a memory buffer time version exists to write directly inside a memory buffer
......
/** /**
\page subp_logger Loggers \page subp_logger Loggers
\section sec_logger Initialization of the logger \section sec_init_rt_logger Initialization of the logger
\subsection subsec_logger_hcpp Header and preprocessor variable \subsection subsec_init_rt_logger_hcpp Header and preprocessor variable
In order to activate the logger you need to add the following lines: In order to activate the logger you need to add the following lines:
\code \code
...@@ -22,57 +22,20 @@ It is possible to set the output stream of the messages inside a file: ...@@ -22,57 +22,20 @@ It is possible to set the output stream of the messages inside a file:
dynamicgraph::RealTimeLogger::destroy(); dynamicgraph::RealTimeLogger::destroy();
\endcode \endcode
Here the file is "/tmp/dg-LOGS.txt".
\subsection subsec_logger_init Initialization of the logger \section sec_use_rt_logger Using the rt_logger
Inside the constructor of the entity:
\code
logger_.setTimeSample(0.001);
logger_.setStreamPrintPeriod(0.005);
logger_.setVerbosity(VERBOSITY_ALL);
LoggerVerbosity alv = logger_.getVerbosity();
\endcode
The first line sets the frequency at which the logger will be updated.<br>
The second line specifies at which frequency the STREAM messages should be
printed.<br>
The third line specifies the level of message to accept.<br>
The fourth line returns the level of verbosity.
In this case, all messages are accepted and the STREAM message are displayed on
the output streams once on five. <br>
The full list of options are:
<ul>
<li>VERBOSITY_ALL: Accept all messages</li>
<li>VERBOSITY_INFO_WARNING_ERROR: Accept messages at minimum level : INFO,
WARNING, ERROR</li> <li>VERBOSITY_WARNING_ERROR: Accept messages at minimum
level : WARNING, ERROR</li> <li>VERBOSITY_ERROR: Accept messages at minimum
level : ERROR</li>
</ul>
\newcode
// Somewhere in your library
dgRTLOG() << "your message. Prefer to use \n than std::endl."
\endcode
\section sec_logger_tests Displaying messages
Here is some example on how to display or record some information. Here the output file is "/tmp/dg-LOGS.txt".
\code
sendMsg("This is a message of level MSG_TYPE_DEBUG",MSG_TYPE_DEBUG,
__FILE__,__LINE__); sendMsg("This is a message of level
MSG_TYPE_INFO",MSG_TYPE_INFO, __FILE__,__LINE__); sendMsg("This is a message of
level MSG_TYPE_WARNING",MSG_TYPE_WARNING, __FILE__,__LINE__); sendMsg("This is a
message of level MSG_TYPE_ERROR",MSG_TYPE_ERROR, __FILE__,__LINE__);
sendMsg("This is a message of level
MSG_TYPE_DEBUG_STREAM",MSG_TYPE_DEBUG_STREAM, __FILE__,__LINE__); sendMsg("This
is a message of level MSG_TYPE_INFO_STREAM",MSG_TYPE_INFO_STREAM,
__FILE__,__LINE__); sendMsg("This is a message of level
MSG_TYPE_WARNING_STREAM",MSG_TYPE_WARNING_STREAM, __FILE__,__LINE__);
sendMsg("This is a message of level
MSG_TYPE_ERROR_STREAM",MSG_TYPE_ERROR_STREAM, __FILE__,__LINE__);
logger_.countdown();
\endcode
Specifying the file with __FILE__ and the line inside the file by __LINE__ are Specifying the file with __FILE__ and the line inside the file by __LINE__ are
necessary for the STREAM messages. Indeed they are indexed using the two values. necessary for the STREAM messages. Indeed they are indexed using the two values.
As the default value are "" and 0 the counting will be confused. The default values "" and 0 for the counting are not well understood.
*/ */
...@@ -10,8 +10,8 @@ are recorded to a memory buffer, which can be emptied at any time. ...@@ -10,8 +10,8 @@ are recorded to a memory buffer, which can be emptied at any time.
The \b commands that this entity exposes are: The \b commands that this entity exposes are:
\code \code
empty (discards all buffers) empty (discards all buffers)
buffersize (sets buffer size for recording) getBufferSize (gets buffer size for recording)
trace (writes traces to files) setBufferSize (sets buffer size for recording)
\endcode \endcode
Plus all the commands exposed by \ref tracerdoc Plus all the commands exposed by \ref tracerdoc
\n \n
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment