Hi,
there are plenty of debug, trace, log functions already built in most development environments but I have written my own wrapper which adds functionality. Basically it is a single function where I pass the values/fields listed below then I can do all sorts of logging, printing based on all sorts of filtering to affects its behaviour during debug or build.
- time since start (or OS ticks)
- level (Error, warning, debug, info, log)
- comment
- file
- function
- line (sometimes redundant if you use function but not always)
- software break (yes/no)
- up to 5 parameters (uint32 that I can use to log any info/variable)
Then through #defines I can decide different behaviours. For example in debug I can customise that function to print to the console all messages from a certain function after a specific time. Or again as another example, in release mode store into a uSD card all data that has a level of "Log" together with the associated parameters.
My questions are:
1) have any of you done something similar or do you know of similar libraries?
2) any suggestions/feedback on the concept and/or what would u add?
Thank you