Logging Framework

The redBlocks component library provides the infrastructure for consistent and convenient debug logging to arbitrary interfaces (e. g. serial, Telnet client, RAM, ...). Logging commands that are only needed during integration and for debugging purposes can be activated or removed at compile time with a single configuration option, in order to keep the release version compact.

The framework can be flexibly configured and is implemented extremely efficient to meet the needs of embedded software applications for very resource-limited platforms. Just like STL streams, it uses the <<-operator in order to concatenate variables of different type, which makes logging extremely convenient to use. Despite this fact, there are no unnecessary copy operations, so it writes the logging output directly to the configured interface (in case of serial logging, directly to the driver's send buffer).

Example Code

void savePIDConfiguration(unsigned int index, float p, float i, float d)
{
  // ...
 
  RB_LOG_DEBUG("Loop controller " << index << " configuration updated: p=" << p << ", i=" << i << ", d=" << d);
}

This approach is also much more efficient than the commonly used printf-debugging in many C applications, which requires a printf format string to be parsed for each logging output during runtime.