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 argument NBLog. It places log on the log buffer with index buffer_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 new Log * with typical parameters and passes it to the two argument NBLog. Parameter where_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 the contents 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 in items.

  • Both items and data are copied by this function.

⚠️ **GitHub.com Fallback** ⚠️