Closed oneandonlyonebutyou closed 2 years ago
Not at present. What I have done in the past is to make an internal print macro, such as debug_print
. If a definition is present, such as DISABLE_DEBUG_PRINTS
, it is defined to an empty value, otherwise it simply aliases printf
.
I'll work on implementing something like that in the Arduino library wrapper next week.
Alternatively, our logging library already supports this behavior (as well as configurable log levels): https://github.com/embeddedartistry/arduino-logger
Not at present. What I have done in the past is to make an internal print macro, such as
debug_print
. If a definition is present, such asDISABLE_DEBUG_PRINTS
, it is defined to an empty value, otherwise it simply aliasesprintf
.I'll work on implementing something like that in the Arduino library wrapper next week.
Thank you..: I am not such an expert on macros How does your macro looks like to be able to print multiple values
General form:
#ifdef DISABLE_DEBUG_PRINT
#define debug_print(...)
#else
#define debug_print(...) printf(__VA_ARGS__)
#endif
Whoops, corrected printf(...)
to printf(__VA_ARGS__)
Thank you .. :)
Sometimes i do this on a per-file basis for fine grained control. For application wide control i would make a new header like debug_print.h. In that you could include the printf header. Your source files will include the debug_printf.h header
Cheers,
Phillip
On May 20, 2022, at 14:16, Joseph @.***> wrote:
thank you so much .. Do I need to put that in all files ... ? I put this on my mian, and other files do not see it ..
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.
Is there any macro where I could diable all prints, and basically fully remove the lib, when I am not debugging