-
Notifications
You must be signed in to change notification settings - Fork 76
nblog
The functions for passing data to the robot-side log server are overloads of NBLog()
, declared in logging.h and defined in log_main.cpp.
If the logging system is not running, these functions return immediately. The functions are different enough to be covered in separate sections.
Note: there are currently only two log buffers, with index macros defined in logging.h
as NBL_IMAGE_BUFFER
for large logs and NBL_SMALL_BUFFER
for smaller ones.
-
NBLog(int buffer_index, Log * log)
: This function is called by the the four argumentNBLog
. It placeslog
on the log buffer with indexbuffer_index
in a synchronized manner. This means you may safely call this function from anywhere (any thread) in the man process.log
and its fields should not be modified after calling this function. If the logging system is not running,log
is deleted immediately. -
NBLog(int buffer_index, const std::string& where_called, const std::vector<SExpr>& items, const std::string& data )
: This function is the one typically called to log stuff in man. It creates a newLog *
with typical parameters and passes it to the two argumentNBLog
. Parameterwhere_called
may be anything – it is only used in nbtool for human comprehension.items
should list the SExpr dictionaries of any items the log might contain. The field will be appended to thecontents
list of the resulting log's SExpr tree.data
is simply interpreted as a opaque byte buffer. It may contain anything – nbtool will determine how to interpret it based on the nodes initems
. -
Both
items
anddata
are copied by this function.