Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bananas

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bananas - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

31

lib/index.js

@@ -17,3 +17,4 @@ 'use strict';

root: false,
exclude: []
exclude: [],
uncaughtException: false
}

@@ -30,3 +31,3 @@ };

// Setup log queue and flush intervals
// Setup log queue

@@ -50,4 +51,30 @@ const uri = `https://logs-01.loggly.com/bulk/${settings.token}`;

// Setup flush intervals
const timerId = setInterval(flush, settings.intervalMsec);
// Listen to system exceptions
if (settings.uncaughtException) {
process.once('uncaughtException', (err) => {
const uncaught = internals.update('error');
uncaught.error = {
message: err.message,
stack: err.stack,
data: err.data
};
uncaught.tags = ['bananas', 'uncaught', 'error'];
updates.push(uncaught);
return flush((ignore) => {
process.exit(1);
});
});
}
// Listen to server events
const onPostStop = function (srv, nextExt) {

@@ -54,0 +81,0 @@

2

package.json
{
"name": "bananas",
"description": "Minimal Loggly hapi plugin",
"version": "1.4.0",
"version": "1.5.0",
"author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)",

@@ -6,0 +6,0 @@ "repository": "git://github.com/hueniverse/bananas",

@@ -252,2 +252,39 @@ 'use strict';

});
it('logs uncaughtException event', { parallel: false }, (done) => {
const server = new Hapi.Server({ debug: false });
server.connection();
const settings = {
token: 'abcdefg',
intervalMsec: 50,
uncaughtException: true
};
let updates = [];
const orig = Wreck.post;
Wreck.post = function (uri, options, next) {
updates = updates.concat(options.payload.split('\n'));
return next();
};
const exit = process.exit;
process.exit = (code) => {
process.exit = exit;
Wreck.post = orig;
expect(updates.length).to.equal(2);
expect(code).to.equal(1);
done();
};
server.register({ register: Bananas, options: settings }, (err) => {
expect(err).to.not.exist();
process.emit('uncaughtException', new Error('boom'));
});
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc