Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.12 KB

README.md

File metadata and controls

34 lines (23 loc) · 1.12 KB

psyslog

About

This library provides a UDP or TCP syslog client for logging data from Particle apps.

It has been tested on the Photon in combination with rsyslog. Other devices and syslog daemons may work! Feel free to contact me via email ([email protected]) if you have issues with untested devices.

Usage

Add the following to the top of your application:

#define SYSLOG_DEBUG
#include "psyslog/psyslog.h"

Then, set up the remote log endpoint:

syslog_initialize("logs.example.com", 514);

If you want to send logs over TCP, pass true as the third parameter to syslog_initialize.

To actually log data, use the following macros:

LOGE("This is an error message!");
LOGI("Informational messages are less important);

By default, the library will log using the device's MAC address as its hostname. If you want to use the Particle device ID, add #define SYSLOG_USE_DEVICEID before the include.

syslog servers

An example rsyslog configuration file is included. It will automatically separate logs by hostname and store them in /var/log/particle/.