@@ -58,11 +58,14 @@ void Arduino_DebugUtils::timestampOff() {
5858 _timestamp_on = false ;
5959}
6060
61- void Arduino_DebugUtils::print (int const debug_level, const char * fmt, ...) {
61+ void Arduino_DebugUtils::print (int const debug_level, const char * fmt, ...)
62+ {
6263 if (debug_level >= DBG_ERROR &&
6364 debug_level <= DBG_VERBOSE &&
64- debug_level <= _debug_level) {
65- if (_timestamp_on) {
65+ debug_level <= _debug_level)
66+ {
67+ if (_timestamp_on)
68+ {
6669 char timestamp[20 ];
6770 snprintf (timestamp, 20 , " [ %lu ] " , millis ());
6871 _debug_output_stream->print (timestamp);
@@ -75,6 +78,28 @@ void Arduino_DebugUtils::print(int const debug_level, const char * fmt, ...) {
7578 }
7679}
7780
81+ void Arduino_DebugUtils::print (int const debug_level, const __FlashStringHelper * fmt, ...)
82+ {
83+ if (debug_level >= DBG_ERROR &&
84+ debug_level <= DBG_VERBOSE &&
85+ debug_level <= _debug_level)
86+ {
87+ if (_timestamp_on)
88+ {
89+ char timestamp[20 ];
90+ snprintf (timestamp, 20 , " [ %lu ] " , millis ());
91+ _debug_output_stream->print (timestamp);
92+ }
93+
94+ String fmt_str (fmt);
95+
96+ va_list args;
97+ va_start (args, fmt_str.c_str ());
98+ vPrint (fmt_str.c_str (), args);
99+ va_end (args);
100+ }
101+ }
102+
78103/* *****************************************************************************
79104 PRIVATE MEMBER FUNCTIONS
80105 ******************************************************************************/
0 commit comments