bunyan-loggly
Advanced tools
Comparing version 1.4.2 to 2.0.0
10
index.js
var loggly = require('node-loggly-bulk'); | ||
var stringifySafe = require('json-stringify-safe'); | ||
var noop = function() {}; | ||
var noop = function () {}; | ||
@@ -27,5 +27,7 @@ function Bunyan2Loggly(logglyConfig, bufferLength, bufferTimeout, callback) { | ||
Bunyan2Loggly.prototype.write = function(originalData) { | ||
Bunyan2Loggly.prototype.write = function (originalData) { | ||
if (typeof originalData !== 'object') { | ||
throw new Error('bunyan-loggly requires a raw stream. Please define the type as raw when setting up the bunyan stream.'); | ||
throw new Error( | ||
'bunyan-loggly requires a raw stream. Please define the type as raw when setting up the bunyan stream.', | ||
); | ||
} | ||
@@ -43,3 +45,3 @@ | ||
bunyan2Loggly.logglyClient.log(data, function(error, result) { | ||
bunyan2Loggly.logglyClient.log(data, function (error, result) { | ||
bunyan2Loggly.callback(error, result, data); | ||
@@ -46,0 +48,0 @@ }); |
{ | ||
"name": "bunyan-loggly", | ||
"version": "1.4.2", | ||
"description": "A bunyan stream to transport logs to loggly", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"keywords": [ | ||
"bunyan", | ||
"log", | ||
"loggly" | ||
], | ||
"author": "Maurice Butler <maurice.butler@gmail.com>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"json-stringify-safe": "^5.0.1", | ||
"node-loggly-bulk": "^2.2.4" | ||
}, | ||
"devDependencies": { | ||
"@types/bunyan": "^1.8.6", | ||
"proxyquire": "^2.1.3", | ||
"tape": "^4.13.2" | ||
}, | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"test": "node ./tests" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/MauriceButler/bunyan-loggly.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/MauriceButler/bunyan-loggly/issues" | ||
}, | ||
"homepage": "https://github.com/MauriceButler/bunyan-loggly#readme" | ||
"name": "bunyan-loggly", | ||
"version": "2.0.0", | ||
"description": "A bunyan stream to transport logs to loggly", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"keywords": [ | ||
"bunyan", | ||
"log", | ||
"loggly" | ||
], | ||
"author": "Maurice Butler <maurice.butler@gmail.com>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"json-stringify-safe": "^5.0.1", | ||
"node-loggly-bulk": "^3.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/bunyan": "^1.8.8", | ||
"proxyquire": "^2.1.3", | ||
"tape": "^5.5.3" | ||
}, | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"test": "node ./tests" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/MauriceButler/bunyan-loggly.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/MauriceButler/bunyan-loggly/issues" | ||
}, | ||
"homepage": "https://github.com/MauriceButler/bunyan-loggly#readme" | ||
} |
@@ -11,5 +11,5 @@ var test = require('tape'); | ||
'node-loggly-bulk': { | ||
createClient: function() { | ||
createClient: function () { | ||
return { | ||
log: function() {}, | ||
log: function () {}, | ||
}; | ||
@@ -21,3 +21,3 @@ }, | ||
test('Bunyan2Loggly Exists', function(t) { | ||
test('Bunyan2Loggly Exists', function (t) { | ||
t.plan(1); | ||
@@ -30,3 +30,3 @@ | ||
test('Bunyan2Loggly throws on bad config', function(t) { | ||
test('Bunyan2Loggly throws on bad config', function (t) { | ||
t.plan(4); | ||
@@ -38,32 +38,32 @@ | ||
t.throws( | ||
function() { | ||
function () { | ||
new Bunyan2Loggly(); | ||
}, | ||
exceptionMessage, | ||
'throws on bad config' | ||
'throws on bad config', | ||
); | ||
t.throws( | ||
function() { | ||
function () { | ||
new Bunyan2Loggly({}); | ||
}, | ||
exceptionMessage, | ||
'throws on bad config' | ||
'throws on bad config', | ||
); | ||
t.throws( | ||
function() { | ||
function () { | ||
new Bunyan2Loggly({ token: 'foo' }); | ||
}, | ||
exceptionMessage, | ||
'throws on bad config' | ||
'throws on bad config', | ||
); | ||
t.throws( | ||
function() { | ||
function () { | ||
new Bunyan2Loggly({ subdomain: 'foo' }); | ||
}, | ||
exceptionMessage, | ||
'throws on bad config' | ||
'throws on bad config', | ||
); | ||
}); | ||
test('Bunyan2Loggly creates loggly client', function(t) { | ||
test('Bunyan2Loggly creates loggly client', function (t) { | ||
t.plan(3); | ||
@@ -73,3 +73,3 @@ | ||
mocks['node-loggly-bulk'].createClient = function(config) { | ||
mocks['node-loggly-bulk'].createClient = function (config) { | ||
t.equal(config.token, testConfig.token, 'correct token'); | ||
@@ -85,3 +85,3 @@ t.equal(config.subdomain, testConfig.subdomain, 'correct subdomain'); | ||
test('Bunyan2Loggly sets default bufferLength', function(t) { | ||
test('Bunyan2Loggly sets default bufferLength', function (t) { | ||
t.plan(1); | ||
@@ -95,3 +95,3 @@ | ||
test('Bunyan2Loggly sets bufferLength if provided', function(t) { | ||
test('Bunyan2Loggly sets bufferLength if provided', function (t) { | ||
t.plan(1); | ||
@@ -105,3 +105,3 @@ | ||
test('Bunyan2Loggly sets default bufferTimeout', function(t) { | ||
test('Bunyan2Loggly sets default bufferTimeout', function (t) { | ||
t.plan(1); | ||
@@ -115,3 +115,3 @@ | ||
test('Bunyan2Loggly sets bufferTimeout if provided', function(t) { | ||
test('Bunyan2Loggly sets bufferTimeout if provided', function (t) { | ||
t.plan(1); | ||
@@ -125,3 +125,3 @@ | ||
test('Bunyan2Loggly sets isBulk if provided', function(t) { | ||
test('Bunyan2Loggly sets isBulk if provided', function (t) { | ||
t.plan(1); | ||
@@ -131,3 +131,3 @@ | ||
mocks['node-loggly-bulk'].createClient = function(config) { | ||
mocks['node-loggly-bulk'].createClient = function (config) { | ||
t.equal(config.isBulk, false, 'isBulk set correctly'); | ||
@@ -140,3 +140,3 @@ }; | ||
test('Bunyan2Logly defaults isBulk if not provided', function(t) { | ||
test('Bunyan2Logly defaults isBulk if not provided', function (t) { | ||
t.plan(1); | ||
@@ -146,3 +146,3 @@ | ||
mocks['node-loggly-bulk'].createClient = function(config) { | ||
mocks['node-loggly-bulk'].createClient = function (config) { | ||
t.equal(config.isBulk, true, 'isBulk defaults to true'); | ||
@@ -155,3 +155,3 @@ }; | ||
test('Bunyan2Loggly throws if write called with non raw stream', function(t) { | ||
test('Bunyan2Loggly throws if write called with non raw stream', function (t) { | ||
t.plan(2); | ||
@@ -161,21 +161,22 @@ | ||
var bunyan2Loggly = new Bunyan2Loggly(testConfig); | ||
var exceptionMessage = /bunyan-loggly requires a raw stream. Please define the type as raw when setting up the bunyan stream./; | ||
var exceptionMessage = | ||
/bunyan-loggly requires a raw stream. Please define the type as raw when setting up the bunyan stream./; | ||
t.throws( | ||
function() { | ||
function () { | ||
bunyan2Loggly.write(); | ||
}, | ||
exceptionMessage, | ||
'throws on bad stream' | ||
'throws on bad stream', | ||
); | ||
t.throws( | ||
function() { | ||
function () { | ||
bunyan2Loggly.write('foo'); | ||
}, | ||
exceptionMessage, | ||
'throws on bad stream' | ||
'throws on bad stream', | ||
); | ||
}); | ||
test('Bunyan2Loggly changes time to timestamp', function(t) { | ||
test('Bunyan2Loggly changes time to timestamp', function (t) { | ||
t.plan(1); | ||
@@ -188,5 +189,5 @@ | ||
mocks['node-loggly-bulk'].createClient = function() { | ||
mocks['node-loggly-bulk'].createClient = function () { | ||
return { | ||
log: function(data) { | ||
log: function (data) { | ||
t.deepEqual(data, responseData, 'data sent to loggly'); | ||
@@ -202,3 +203,3 @@ }, | ||
test('Bunyan2Loggly sends data to loggly', function(t) { | ||
test('Bunyan2Loggly sends data to loggly', function (t) { | ||
t.plan(1); | ||
@@ -210,5 +211,5 @@ | ||
mocks['node-loggly-bulk'].createClient = function() { | ||
mocks['node-loggly-bulk'].createClient = function () { | ||
return { | ||
log: function(data) { | ||
log: function (data) { | ||
t.deepEqual(data, testData, 'data sent to loggly'); | ||
@@ -224,3 +225,3 @@ }, | ||
test('Bunyan2Loggly uses logglyCallback if provided', function(t) { | ||
test('Bunyan2Loggly uses logglyCallback if provided', function (t) { | ||
t.plan(3); | ||
@@ -240,5 +241,5 @@ | ||
mocks['node-loggly-bulk'].createClient = function() { | ||
mocks['node-loggly-bulk'].createClient = function () { | ||
return { | ||
log: function(data, callback) { | ||
log: function (data, callback) { | ||
callback(testError, testResult); | ||
@@ -254,3 +255,3 @@ }, | ||
test('Bunyan2Loggly handles circular references', function(t) { | ||
test('Bunyan2Loggly handles circular references', function (t) { | ||
t.plan(2); | ||
@@ -264,5 +265,5 @@ | ||
mocks['node-loggly-bulk'].createClient = function() { | ||
mocks['node-loggly-bulk'].createClient = function () { | ||
return { | ||
log: function(data) { | ||
log: function (data) { | ||
t.notEqual(data, testData, 'original data was not mutated'); | ||
@@ -269,0 +270,0 @@ t.deepEqual(data, { timestamp: 'nao' }, 'changed to timestamp'); |
15153
262
+ Addednode-loggly-bulk@3.0.1(transitive)
- Removednode-loggly-bulk@2.2.5(transitive)
Updatednode-loggly-bulk@^3.0.1