New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

homey-syslog

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homey-syslog - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

24

index.js

@@ -12,4 +12,6 @@ const syslog = require('syslog-client');

module.exports = (host = Homey.env.SYSLOG_HOST, opts = {}) => {
let port = opts.port || Homey.env.SYSLOG_PORT || 514;
let transport = opts.transport === 'tcp' ? syslog.Transport.Tcp : syslog.Transport.Udp;
let port = opts.port || Homey.env.SYSLOG_PORT || 514;
let syslogHostname = opts.syslogHostname || Homey.env.SYSLOG_HOSTNAME || 'Homey';
let globalHandlers = opts.globalHandlers || Homey.env.SYSLOG_GLOBALHANDLERS === true;
let transport = opts.transport === 'tcp' ? syslog.Transport.Tcp : syslog.Transport.Udp;

@@ -21,3 +23,7 @@ if (host == null || port == null) {

// Instantiate syslog client.
let client = syslog.createClient(host, { port, transport }).on('error', e => {
let client = syslog.createClient(host, {
port,
transport,
syslogHostname,
}).on('error', e => {
console.error('syslog error', e.message);

@@ -32,2 +38,14 @@ });

}
// Install global error handlers?
if (opts.globalHandlers === true) {
let handler = e => {
log.call(console, e);
client.log(format(e), () => {
client.close();
process.exit(1);
}, 3000);
}
process.on('uncaughtException', handler).on('unhandledRejection', handler);
}
};

2

package.json
{
"name": "homey-syslog",
"version": "1.0.0",
"version": "1.0.1",
"description": "Remote syslog logging for Homey apps",

@@ -5,0 +5,0 @@ "main": "index.js",

# homey-syslog
A simple library to enable [Homey](https://www.athom.com/) apps to log to a remote syslog server.
A simple library to enable [Homey](https://www.athom.com/) 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.

@@ -31,2 +31,3 @@ This library patches the built-in Homey logging code so anything that gets logged will _also_ be logged to the syslog server.

* `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`.

@@ -37,4 +38,5 @@ ## Example

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

@@ -47,4 +49,8 @@ ```

An option could be to explicitly set a `DEBUG` environment variable in `env.json`, and only load this library that that variable evaluates to true:
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') {

@@ -51,0 +57,0 @@ require('homey-syslog')(...);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc