Debugging (run time on/off) at Source Firmware code for photon

Some help please,
I know than I have to use debug_output_ function in order to get debug messages at run time.
What I do not find is where I have to turn on debugging.

I’m also looking for the answer to this question. I found the function
void set_logger_output(debug_output_fn output, LoggerOutputLevel level)
will implement the
debug_output_
function. But after looking into the source code and libraries, the
set_logger_output
doesn’t been invoked by anywhere.

So regarding to Photon, how to implement debug print:
DEBUG("Hello from Spark!");
in the function
app_setup_and_loop()

I just remeber from core that it was easy by ,somehow, setting DEBUG mode to something , but I do not remenber more

static bool log = false;
void debug_output_(const char *p)
{
    if (log)
        Serial.println(p);
}

And then in setup()

Serial.begin(57600);
log = true;

That is what found, but it does not work to me.

Debugging docs here - https://github.com/spark/firmware/blob/develop/docs/debugging.md

1 Like