winston-syslog
Advanced tools
Comparing version 1.2.5 to 1.2.6
@@ -13,2 +13,3 @@ /* | ||
cycle = require('cycle'), | ||
utils = require('./utils'), | ||
glossy = require('glossy'), | ||
@@ -63,10 +64,11 @@ winston = require('winston'), | ||
this.protocol = options.protocol || 'udp4'; | ||
this.isDgram = /^udp|^unix/.test(this.protocol); | ||
this.endOfLine = options.eol; | ||
if (!/^udp|unix|unix-connect|tcp/.test(this.protocol)) { | ||
throw new Error('Invalid syslog protocol: ' + this.protocol); | ||
} | ||
var parsedProtocol = utils.parseProtocol(this.protocol); | ||
if (/^unix/.test(this.protocol) && !this.path) { | ||
this.protocolType = parsedProtocol.type; | ||
this.protocolFamily = parsedProtocol.family; | ||
this.isDgram = parsedProtocol.isDgram; | ||
this.endOfLine = options.eol; | ||
if (this.protocolType === 'unix' && !this.path) { | ||
throw new Error('`options.path` is required on unix dgram sockets.'); | ||
@@ -186,3 +188,3 @@ } | ||
if (self.protocol.match(/^udp/)) { | ||
if (self.protocolType === 'udp') { | ||
self.inFlight++; | ||
@@ -262,10 +264,11 @@ self.socket.send(buffer, 0, buffer.length, self.port, self.host, onError); | ||
if (this.isDgram) { | ||
if (self.protocol.match(/^udp/)) { | ||
this.socket = new dgram.Socket(this.protocol); | ||
if (this.protocol === 'unix-connect') { | ||
return this._unixDgramConnect(callback); | ||
} | ||
else if (self.protocol === 'unix') { | ||
else if (this.protocol === 'unix') { | ||
this.socket = require('unix-dgram').createSocket('unix_dgram'); | ||
} | ||
else { | ||
return this._unixDgramConnect(callback); | ||
// UDP protocol | ||
this.socket = new dgram.Socket(this.protocol); | ||
} | ||
@@ -276,3 +279,3 @@ | ||
else { | ||
this.socket = new net.Socket({ type: this.protocol }); | ||
this.socket = new net.Socket(); | ||
this.socket.setKeepAlive(true); | ||
@@ -340,3 +343,12 @@ this.socket.setNoDelay(); | ||
this.socket.connect(this.port, this.host); | ||
var connectConfig = { | ||
host: this.host, | ||
port: this.port | ||
}; | ||
if (this.protocolFamily) { | ||
connectConfig.family = this.protocolFamily; | ||
} | ||
this.socket.connect(connectConfig); | ||
}; | ||
@@ -343,0 +355,0 @@ |
{ | ||
"name": "winston-syslog", | ||
"description": "A syslog transport for winston", | ||
"version": "1.2.5", | ||
"version": "1.2.6", | ||
"author": "Charlie Robbins <charlie.robbins@gmail.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -49,3 +49,3 @@ # winston-syslog | ||
* __localhost:__ Host to indicate that log messages are coming from (Default: `localhost`). | ||
* __type:__ The type of the syslog protocol to use (Default: `BSD`). | ||
* __type:__ The type of the syslog protocol to use (Default: `BSD`, also valid: `5424`). | ||
* __app_name:__ The name of the application (Default: `process.title`). | ||
@@ -52,0 +52,0 @@ * __eol:__ The end of line character to be added to the end of the message (Default: Message without modifications). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
26361
9
686
3