nblog - northern-bites/nbites GitHub Wiki
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 placeslogon the log buffer with indexbuffer_indexin a synchronized manner. This means you may safely call this function from anywhere (any thread) in the man process.logand its fields should not be modified after calling this function. If the logging system is not running,logis 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_calledmay be anything – it is only used in nbtool for human comprehension.itemsshould list the SExpr dictionaries of any items the log might contain. The field will be appended to thecontentslist of the resulting log's SExpr tree.datais simply interpreted as a opaque byte buffer. It may contain anything – nbtool will determine how to interpret it based on the nodes initems. -
Both
itemsanddataare copied by this function.