Skip to content

Latest commit

 

History

History
83 lines (53 loc) · 2.18 KB

rlog.md

File metadata and controls

83 lines (53 loc) · 2.18 KB

H4P Logo

H4P_RemoteLogger

Shortname rlog

H4P_RemoteLogger registers a handler function with a selected set of events, which are saved to sent to a remote url as POST request with application/x-www-form-urlencoded data fields.

For information on how to use this plugin, see Everything is an event: Listeners, Emitters and Handlers

Contents


Introduction

The data fields' names will need to be known by the remote server's POST handler.

  • device
  • type
  • source
  • msg

Usage

H4P_RemoteLogger myLL(...

This plugin is a "singleton" - there may be only one single instance of it in the app. It may be instantiated as any name the user chooses.

Dependencies

H4P_AsyncHTTP

Commands Added

N/A

Service Commands

stop / start have no effect

Callback functions

N/A


API

/* constructor
// url remote server format "http://host:port/path/?a=b..." can start https://. port, path, query all optional
// e.g. "http://myserver.local:1883"
filter; // Name of the event (or combination of events) to be written to the log
*/
H4P_RemoteLogger(const string& url,uint32_t filter=H4PE_ALL);

Example Code

See also MySQL event logger github repo for a NodeJS / Express demo webserver which will process the events sent by H4P_RemoteLogger and store them in a MySQL database


(c) 2021 Phil Bowles [email protected]