winston-papertrail
Advanced tools
Comparing version 0.1.4 to 0.1.5
@@ -13,2 +13,3 @@ /* | ||
var os = require('os'), | ||
net = require('net'), | ||
tls = require('tls'), | ||
@@ -61,2 +62,5 @@ util = require('util'), | ||
var self = this; | ||
self._KEEPALIVE_INTERVAL = 15 * 1000; | ||
options = options || {}; | ||
@@ -85,3 +89,3 @@ | ||
return level + ' ' + message; | ||
} | ||
}; | ||
@@ -133,44 +137,47 @@ // Number of attempts before decaying reconnection | ||
} | ||
self.stream = tls.connect(self.port, self.host, { | ||
self.socket = net.createConnection(self.port, self.host, function () { | ||
self.socket.setKeepAlive(true, self._KEEPALIVE_INTERVAL); | ||
self.stream = tls.connect({ | ||
socket: self.socket, | ||
rejectUnauthorized: false | ||
}, onConnected); | ||
}, onConnected); | ||
self.stream.on('error', function (err) { | ||
self.emit('error', err); | ||
self.stream.on('error', function (err) { | ||
self.emit('error', err); | ||
// We may be disconnected from the papertrail endpoint for any number of reasons; | ||
// i.e. inactivity, network problems, etc, and we need to be resilient against this | ||
// that said, we back off reconnection attempts in case Papertrail is truly down | ||
// We may be disconnected from the papertrail endpoint for any number of reasons; | ||
// i.e. inactivity, network problems, etc, and we need to be resilient against this | ||
// that said, we back off reconnection attempts in case Papertrail is truly down | ||
setTimeout(function () { | ||
setTimeout(function () { | ||
// Increment our retry counts | ||
self.currentRetries++; | ||
self.totalRetries++; | ||
// Increment our retry counts | ||
self.currentRetries++; | ||
self.totalRetries++; | ||
// Decay the retry rate exponentially up to max between attempts | ||
if ((self.connectionDelay < self.maxDelayBetweenReconnection) && | ||
(self.currentRetries >= self.attemptsBeforeDecay)) { | ||
self.connectionDelay = self.connectionDelay * 2; | ||
self.currentRetries = 0; | ||
} | ||
// Decay the retry rate exponentially up to max between attempts | ||
if ((self.connectionDelay < self.maxDelayBetweenReconnection) && | ||
(self.currentRetries >= self.attemptsBeforeDecay)) { | ||
self.connectionDelay = self.connectionDelay * 2; | ||
self.currentRetries = 0; | ||
} | ||
connectStream(); | ||
connectStream(); | ||
// Stop buffering messages after a fixed number of retries. | ||
// This is to keep the buffer from growing unbounded | ||
if (self.loggingEnabled && | ||
(self.totalRetries >= (self.maximumAttempts))) { | ||
self.loggingEnabled = false; | ||
self.emit('error', new Error('Max entries eclipsed, disabling buffering')); | ||
} | ||
// Stop buffering messages after a fixed number of retries. | ||
// This is to keep the buffer from growing unbounded | ||
if (self.loggingEnabled && | ||
(self.totalRetries >= (self.maximumAttempts))) { | ||
self.loggingEnabled = false; | ||
self.emit('error', new Error('Max entries eclipsed, disabling buffering')); | ||
} | ||
}, self.connectionDelay); | ||
}); | ||
}, self.connectionDelay); | ||
}); | ||
// If we have the stream end, simply reconnect | ||
self.stream.on('end', function () { | ||
connectStream(); | ||
}); | ||
// If we have the stream end, simply reconnect | ||
self.stream.on('end', function () { | ||
connectStream(); | ||
}); | ||
}); | ||
} | ||
@@ -177,0 +184,0 @@ |
{ | ||
"name": "winston-papertrail", | ||
"description": "A Papertrail transport for winston", | ||
"version": "0.1.4", | ||
"author": "Ken Perkins <ken.perkins@rackspace.com>", | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/kenperkins/winston-papertrail.git" | ||
}, | ||
"keywords": ["logging", "sysadmin", "tools", "winston", "papertrail"], | ||
"devDependencies": { | ||
"winston": ">=0.6.x", | ||
"vows": "0.5.x" | ||
}, | ||
"peerDependencies": { | ||
"winston": ">=0.6.x" | ||
}, | ||
"main": "./lib/winston-papertrail", | ||
"scripts": { "test": "vows test/*-test.js --spec" }, | ||
"engines": { "node": ">= 0.4.0" } | ||
"name": "winston-papertrail", | ||
"description": "A Papertrail transport for winston", | ||
"version": "0.1.5", | ||
"author": "Ken Perkins <ken.perkins@rackspace.com>", | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/kenperkins/winston-papertrail.git" | ||
}, | ||
"keywords": [ | ||
"logging", | ||
"sysadmin", | ||
"tools", | ||
"winston", | ||
"papertrail" | ||
], | ||
"devDependencies": { | ||
"winston": ">=0.6.x", | ||
"vows": "0.5.x" | ||
}, | ||
"peerDependencies": { | ||
"winston": ">=0.6.x" | ||
}, | ||
"main": "./lib/winston-papertrail", | ||
"scripts": { | ||
"test": "vows test/*-test.js --spec" | ||
}, | ||
"engines": { | ||
"node": ">= 0.4.0" | ||
} | ||
} |
@@ -23,3 +23,3 @@ /* | ||
var transport = new Papertrail(); | ||
var transport = new Papertrail({host: 'localhost', port: 12345}); | ||
@@ -36,2 +36,2 @@ vows.describe('winston-papertrail').addBatch({ | ||
} | ||
}).export(module); | ||
}).export(module); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Network access
Supply chain riskThis module accesses the network.
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
19
319
40376
2