winston-papertrail
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -0,4 +1,7 @@ | ||
# v0.1.1 # | ||
- set rejectUnauthorized = false for TLS (workaround for issue #6) | ||
# v0.1.0 # | ||
- Removed the levelDecorators option in favor of a format function | ||
- Added a `connected` event for Papertrail | ||
- Added a `connect` event for Papertrail | ||
- Switched to jsdoc format | ||
@@ -5,0 +8,0 @@ - Updated to winston 0.6.x dependency |
@@ -11,3 +11,3 @@ /* | ||
*/ | ||
var os = require('os'), | ||
@@ -23,36 +23,36 @@ tls = require('tls'), | ||
* | ||
* @param {object} options options for your papertrail transport | ||
* @param {object} options options for your papertrail transport | ||
* | ||
* @param {string} options.host host for papertrail endpoint | ||
* @param {string} options.host host for papertrail endpoint | ||
* | ||
* @param {Number} options.port port for papertrail endpoint | ||
* @param {Number} options.port port for papertrail endpoint | ||
* | ||
* @param {string} [options.hostname] name for the logging hostname in Papertrail | ||
* @param {string} [options.hostname] name for the logging hostname in Papertrail | ||
* | ||
* @param {string} [options.program] name for the logging program | ||
* @param {string} [options.program] name for the logging program | ||
* | ||
* @param {string} [options.level] log level for your transport (info) | ||
* @param {string} [options.level] log level for your transport (info) | ||
* | ||
* @param {Function} [options.logFormat] function to format your log message before sending | ||
* @param {Function} [options.logFormat] function to format your log message before sending | ||
* | ||
* @param {Number} [options.attemptsBeforeDecay] how many reconnections should | ||
* be attempted before backing of (5) | ||
* @param {Number} [options.attemptsBeforeDecay] how many reconnections should | ||
* be attempted before backing of (5) | ||
* | ||
* @param {Number} [options.maximumAttempts] maximum attempts before | ||
* disabling buffering (25) | ||
* @param {Number} [options.maximumAttempts] maximum attempts before | ||
* disabling buffering (25) | ||
* | ||
* @param {Number} [options.connectionDelay] delay between | ||
* reconnection attempts in ms (1000) | ||
* @param {Number} [options.connectionDelay] delay between | ||
* reconnection attempts in ms (1000) | ||
* | ||
* @param {Boolean} [options.handleExceptions] passed to base Transport (false) | ||
* @param {Boolean} [options.handleExceptions] passed to base Transport (false) | ||
* | ||
* @param {Number} [options.maxDelayBetweenReconnection] when backing off, | ||
* what's the max time between | ||
* reconnections (ms) | ||
* @param {Number} [options.maxDelayBetweenReconnection] when backing off, | ||
* what's the max time between | ||
* reconnections (ms) | ||
* | ||
* @param {Boolean} [options.inlineMeta] inline multi-line messages (false) | ||
* @param {Boolean} [options.inlineMeta] inline multi-line messages (false) | ||
* | ||
* @type {Function} | ||
*/ | ||
var Papertrail = exports.Papertrail = function(options) { | ||
var Papertrail = exports.Papertrail = function (options) { | ||
@@ -78,5 +78,5 @@ var self = this; | ||
// Format your log messages prior to delivery | ||
self.logFormat = options.logFormat || function(level, message) { | ||
return level + ' ' + message; | ||
} | ||
self.logFormat = options.logFormat || function (level, message) { | ||
return level + ' ' + message; | ||
} | ||
@@ -123,13 +123,14 @@ // Number of attempts before decaying reconnection | ||
function connectStream() { | ||
self.stream = tls.connect(self.port, self.host, {}, onConnected); | ||
self.stream = tls.connect(self.port, self.host, { | ||
rejectUnauthorized: false | ||
}, onConnected); | ||
self.stream.on('error', function(err) { | ||
self.stream.on('error', function (err) { | ||
self.emit('error', err); | ||
// Papertrail has a bug that periodically resets their logging | ||
// services thus disconnecting your transport. We use setTimeout | ||
// to throttle the reconnection attempts in case Papertrail is | ||
// truly offline | ||
// 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 () { | ||
@@ -161,3 +162,3 @@ // Increment our retry counts | ||
// If we have the stream end, simply reconnect | ||
self.stream.on('end', function() { | ||
self.stream.on('end', function () { | ||
connectStream(); | ||
@@ -174,3 +175,3 @@ }); | ||
self.emit('connect', 'Connected to Papertrail at ' + self.host + ':' + self.port); | ||
self.emit('connect', 'Connected to Papertrail at ' + self.host + ':' + self.port); | ||
@@ -203,15 +204,15 @@ // Did we get messages buffered | ||
* | ||
* @param {String} level Level at which to log the message. | ||
* @param {String} msg Message to log | ||
* @param {String|object|Function} [meta] Optional metadata to attach | ||
* @param {Function} callback | ||
* @param {String} level Level at which to log the message. | ||
* @param {String} msg Message to log | ||
* @param {String|object|Function} [meta] Optional metadata to attach | ||
* @param {Function} callback | ||
* @returns {*} | ||
*/ | ||
Papertrail.prototype.log = function(level, msg, meta, callback) { | ||
Papertrail.prototype.log = function (level, msg, meta, callback) { | ||
// make sure we handle when meta isn't provided | ||
// make sure we handle when meta isn't provided | ||
if (typeof(meta) === 'function' && !callback) { | ||
callback = meta; | ||
meta = ''; | ||
} | ||
callback = meta; | ||
meta = ''; | ||
} | ||
@@ -238,3 +239,3 @@ // If the logging buffer is disabled, drop the message on the floor | ||
output += ' ' + util.inspect(meta).replace(/[\n\t]/gm, " "); | ||
} | ||
} | ||
else { | ||
@@ -256,11 +257,11 @@ output += '\n' + util.inspect(meta); | ||
* | ||
* @param {String} hostname Hostname of the source application. | ||
* @param {String} program Name of the source application | ||
* @param {String} level Log level of the message | ||
* @param {String} message The message to deliver | ||
* @param {String} hostname Hostname of the source application. | ||
* @param {String} program Name of the source application | ||
* @param {String} level Log level of the message | ||
* @param {String} message The message to deliver | ||
*/ | ||
Papertrail.prototype.sendMessage = function(hostname, program, level, message) { | ||
Papertrail.prototype.sendMessage = function (hostname, program, level, message) { | ||
var self = this, | ||
lines = [], | ||
lines = [], | ||
msg = '', | ||
@@ -295,3 +296,3 @@ gap = ''; | ||
self.logFormat(level, gap + lines[i]) | ||
+ '\r\n'; | ||
+ '\r\n'; | ||
} | ||
@@ -298,0 +299,0 @@ |
{ | ||
"name": "winston-papertrail", | ||
"description": "A Papertrail transport for winston", | ||
"version": "0.1.0", | ||
"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" | ||
}, | ||
"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.1", | ||
"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" } | ||
} |
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
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
40378
18
288
1