I'm fairly new to programming and C++ language and have been tasked with updating a set of code from using Serial.print statements to Log.info statements. Most of the changes have been very straightforward (directly replacing "Serial.print" with "Log.info"), but one line of code is giving me some trouble (Line 255, seen in the photo, with errors). For reference, we are using a Boron 404X device in version 4.2.0. In my understanding, we are moving from Serial.print statements to Log.info statements because we are receiving 0.00 valued data points instead of actual measurements. Does anyone know how to properly format line 255 using Log.info to eliminate the associated errors? Thank you!
Log.info() internally uses vsnprintf() and hence does not provide overloads that would take a numeric variable as initial parameter.
The first parameter always has to be a string - in particular it should be a "printf() format" string. (hence the error message about the incompatibel parameter type)
Try this instead
Log.info("Sleepint for %i", seconds_to_sleep);
I guess you do a lot of these "archaic" multi line prints in your code which may all want to be rewritten to use the full potential of the logging feature
e.g.
float b = 2.5;
int w = 7;
Log.info("%.1f liters of beer plus %i glass%s of wine is %s!"
, b
, w, (w == 1 ? "" : "es")
, "one big headache");