Logging Internet Button activity to a file

I have an Internet Button that when clicked…

  1. sends a Spark.publish()
  2. that triggers a webhook…
  3. that publishes a message to a Slack channel.

Phew, that all it does in a sentence.

The problem is, I’m not near that device, someone clicks it for me. Sometimes, I don’t get notified but the person tells me it did click the button. I don’t if that person’s telling the truth or if it’s a wifi problem or something else.

How can I debug this? Can I log somewhere each time someone presses a button? I can use wifi for that (since that’s what I’m testing). Can I log into a file? How? How can I read it later?

Could it a weak wifi signal? Maybe putting the device somewhere with a clear view of the wifi hotspot?

Why not keep track of the button clicks on the device itself in the form of a Particle.variable. Every time the button is clicked, you can convert the time to a string, and concatenate that with the previous string. A particle variable can be 622 bytes long, so that’s a fair amount of data (you could create several variables if you need more storage). I’ve done this with one of my apps that I thought was not always getting all its data to Ubidots. You can then simply access the Particle.variable from the CLI, an app, or a web page.