gelf-stream
Advanced tools
Comparing version 0.2.1 to 0.2.2
var gelfStream = exports | ||
var gelfling = require('gelfling') | ||
var map = require('map-stream') | ||
var Stream = require('stream').Stream | ||
@@ -19,10 +19,20 @@ function create(host, port, options) { | ||
var client = gelfling(host, port, options) | ||
, mapStream = map(function send(log, cb) { | ||
if (options.filter && !options.filter(log)) return cb() | ||
client.send(options.map ? options.map(log) : log, cb) | ||
}) | ||
, stream = new Stream() | ||
mapStream.on('end', function() { client.close() }) | ||
client.errHandler = function(err) { | ||
if (err) stream.emit('error', err) | ||
} | ||
return mapStream | ||
stream.writable = true | ||
stream.write = function(log) { | ||
if (!options.filter || options.filter(log)) | ||
client.send(options.map ? options.map(log) : log, client.errHandler) | ||
} | ||
stream.end = function(log) { | ||
if (arguments.length) stream.write(log) | ||
stream.writable = false | ||
process.nextTick(function() { client.close() }) | ||
} | ||
return stream | ||
} | ||
@@ -29,0 +39,0 @@ |
{ | ||
"name": "gelf-stream", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "A stream to send JS objects to a Graylog2 server (in GELF format)", | ||
@@ -20,4 +20,3 @@ "author": "Michael Hart <michael.hart.au@gmail.com> (http://github.com/mhart)", | ||
"dependencies": { | ||
"gelfling": "~0.2.0", | ||
"map-stream": "~0.0.1" | ||
"gelfling": "~0.2.0" | ||
}, | ||
@@ -24,0 +23,0 @@ "devDependencies": { |
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
6332
1
119
- Removedmap-stream@~0.0.1
- Removedmap-stream@0.0.7(transitive)