Saturday, November 16, 2013

Proof of concept: unload formatting of log messages from embedded device

Elecia White explains in Making Embedded Systems: Design Patterns for Great Software how you should unload tasks from the device to the host to save precious processing power for things that must run on the device. This inspired me to show how you can offload the formatting of log messages from the device. The result is a very simple C logging library for the device and a few nifty Ruby scripts for the host. The C library uses some processor magic to mark the logging messages for the Ruby scripts and create a shorthand syntax for outputting log messages. There are still some things to do to turn it into production ready code like decoupling the logging library call and the actual output on the periphery. But hey, it's just a proof of concept! You can find it at https://github.com/matthiaskraaz/binary-logger. There is also a job running on Travis-CI (https://travis-ci.org/matthiaskraaz/binary-logger) showing you the output of the latest version.