Giter Site home page Giter Site logo

homey-syslog's Introduction

homey-syslog

A simple library to enable Homey apps to log to a remote syslog server. This requires that you have a syslog server running somewhere in your network, configured to accept external connections from syslog clients.

This library patches the built-in Homey logging code so anything that gets logged will also be logged to the syslog server.

Installation

$ npm i homey-syslog

Usage

In your apps app.js:

require('homey-syslog')([ SYSLOG_SERVER ][, opts]);

SYSLOG_SERVER is the name or IP-address of your syslog server.

It's optional iff you provide Homey.env.SYSLOG_HOST, i.e. if you have a file env.json that defines it:

{ "SYSLOG_HOST" : "11.22.33.44" }

Valid options:

  • port : TCP/UDP port for the syslog server. Defaults to Homey.env.SYSLOG_PORT, or 514 otherwise.
  • transport: either tcp or udp (the default)
  • globalHandlers: when true, will hook uncaughtException and unhandledRejection to log these errors over syslog. Defaults to Homey.env.SYSLOG_GLOBALHANDLERS === true.

Example

require('homey-syslog')('192.168.1.123', {
  port           : 514,
  transport      : 'tcp'
  globalHandlers : true,
});

DON'T USE IN PRODUCTION CODE

The purpose of this library is to aid during development of Homey apps, it's not intended to be used for apps in production.

An option could be to explicitly set a DEBUG environment variable in env.json, and only load this library when that variable evaluates to true:

// env.json
{ "DEBUG" : "true", "SYSLOG_HOST" : "..." }

// app.js
if (Homey.env.DEBUG === 'true') {
  require('homey-syslog')(...);
}

homey-syslog's People

Contributors

robertklep avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.