I was looking to implement an api like printf for my logging. It should be similar to calling printf.
For example:
persistent_log(LogType0, "This is buffered writing %d", i);
I looked into variable argument stuff , but it seems I need to know the number & type of arguments there. so I need more help in that regard.
Here’s an excerpt from a past project that I found to work well for me. Some initialization steps are of course missing. The key here is the
vfprintffunction which will handle the details of printing the various arguments.