Jafar
|
Module kernel defines a debug stream in class jafar::debug::DebugStream. The use of a singleton class ensures that a single instance of this stream is created. A debug message has two characteristics:
To send a message to the debug stream, one has to use the macros JFR_WARNING, JFR_DEBUG, JFR_VDEBUG, JFR_VVDEBUG defined in jafarMacro.hpp. Each macro sends a message with the corresponding level, the name of the current module is automatically added.
#include "kernel/jafarDebug.hpp" int i = 2; JFR_DEBUG("The value of i is " << i); output: D:pipo/test.cpp:55: The value of i is 2
Module kernel defines kernel::putsDbg
to send a message to the debug stream from the interactive shell. The message is sent with module value shell
and with default level DebugStream::Debug
.
jafar% set i 12 12 jafar% kernel::putsDbg "i=$i" D:shell: i=12 jafar% kernel::putsDbg "i=$i" $::kernel::DebugStream_VeryVerboseDebug jafar%
Here the debug level for pseudo module shell
is DebugStream::Debug
At compile time, debug messages are disabled with the flag JFR_NDEBUG
(Customize the compilation process: Jafar specific flags).
Usually, warning messages are also sent to the debug stream. When the flag JFR_NDEBUG
is defined, warning messages are still active and sent to the std::cerr
stream. To disable all outputs, you can define the flag JFR_QUIET
(Customize the compilation process: Jafar specific flags).
Based on the debugging level and the name of the sending module, debugging messages can be enabled or disabled. When a message is disabled, c++ stream mechanism allows the operation to be very low cost. Moreover, the stream can be sent to a file. The debug stream is configured via static methods of the jafar::debug::DebugStream class. These methods are wrapped by swig and can therefore be used from the interactive shell.
Generated on Wed Oct 15 2014 00:37:30 for Jafar by doxygen 1.7.6.1 |
![]() |