If one is using a dedicated logger module like the McuLog, then you don’t have to worry or care about timestamp support. But if your application is using normal printf()
calls for for logging purpose, you will face issues to adding timestamps to it. You might consider to change all prinft()
calls. This might be a lot of work, or not possible in all cases if you cannot change the source code.
But there is a really cool feature of the GNU linker to solve that problem. It allows to ‘wrap’ around any symbol or function, including the ones in the standard library. That way I can add my mode to the printf(
) code as a wrapper, for example adding a timestamp for every call.
In the example below you can see this in action:
In this article I’ll show how you can wrap any function with custom code.
Continue reading