Papertrail logging library for Particle
Ever wanted to get a log from your code without having to connect it to a PC and use Serial to debug? This library enables Particle hardware to write log to Papertrail, and debug your application even when it's not connected to your machine. This library uses the existing logging mechanism, so you can move to using Papertrail in minutes. Currently, the library send the logs on UDP without any encryption. Since UDP is used, the order of the log entries in Papertrail can be different from the order of the entries sent.
What is Papertrail?
Papertrail provides hosted log management. That means you can upload any log to the cloud. Once uploaded, you can view the entire log, filter it and search it.
Is it free?
Yes! Papertrail provides a free plan! Use referral code
668c8a to get an extra 50/MB/month more log volume for 1 year (and I will get as well).
The library uses the Particle device ID for the Papertrail system by default. And the application name is configurable. The log message itself follows the same pattern as the SerialLogHandler class:
%ISO8601_TIME% %system% %app% [%category%] %log_level%: %text"
For example a full log entry looks like this:
Dec 23 00:09:09 200000000555555555555555 App: [app] ERROR: An error occurred!
- Particle Photon, Core and Electron were verified to work with this library.
Logging on the Electron can consume a lot of data and may result in a higher bill. Be careful about how often you log.
- To use the example, first you need to sign up to Papertrail.
- Once signed up, go to Settings -> Log destinations. There you'll see your host and port. Should be something like
- In the example file, replace
logsX.papertrailapp.comwith your own host, and the port (
12345) with your own.
- You can also replace the app name there (In this example, it was left as "PapertrailSimpleDemo").
- The library uses the deviceID as the deafult system name, you can change this as well in the constructor.
- Flash the application.
- On your Papertrail dashboard, a new system will be created with your device ID. Click on it.
- Your log should look like this:
Feel free to open an issue, open a PR, or to ask a question.