A publish based web logger

Hi ya’ll,

I just made a tiny logging library (which I started by borrowing from the Papertrail logger). It allows you to use Log.foo(…) and have those log messages go to the particle.io servers. You can then optionally use a particle webhook to store the logs in your web log provider of choice (example included of using loggly).

I liked this approach for three reasons:

  • Uses very little flash space
  • Uses the particle transport (so messages aren’t sent in clear text and it isn’t UDP so cell carriers won’t brutally drop it)
  • It works on the argon

The main downside is that publishes can be dropped if high rate, so by default it only logs messages with >= INFO priority.

github

3 Likes