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

bunyan-rotating-file-stream

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bunyan-rotating-file-stream - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

test-perf.js

5

CHANGES.md

@@ -5,2 +5,7 @@ # bunyan Changelog

## 1.1.1
- Being far more aggressive when writing logs in order to improve log writing speed
- Basic performance test that writes 1million logs
## 1.1.0

@@ -7,0 +12,0 @@

23

lib/limitedqueue.js

@@ -14,4 +14,6 @@ 'use strict';

var queue = async.queue(function (s, callback) {
var joiners = []; // List of callbacks to call when we're empty
var queue = async.cargo(function (s, callback) {
var queueLowerThreshold = (maxQueueLength * queueClearingThreshold);

@@ -104,2 +106,10 @@ if (throwLogsAway && queue.length() < queueLowerThreshold) {

}
if (joiners.length > 0) {
for (var i = 0; i < joiners.length; i += 1) {
joiners[i]();
}
joiners = [];
}
}

@@ -111,2 +121,10 @@

function join(cb) {
if (queue.length() === 0) {
cb();
} else {
joiners.push(cb);
}
}
return _.extend({}, {

@@ -116,3 +134,4 @@ push,

pause: queue.pause,
resume: queue.resume
resume: queue.resume,
join
}, base);

@@ -119,0 +138,0 @@ }

36

lib/rotatingfilestream.js

@@ -35,12 +35,17 @@ // A rotating file stream will just

function writer(s, callback) {
var str = JSON.stringify(s, bunyan.safeCycles()) + '\n';
function writer(logs, callback) {
for (var i = 0; i < logs.length; i += 1) {
var str = JSON.stringify(logs[i], bunyan.safeCycles()) + '\n';
stream.write(str, function (err) {
if (err) {
base.emit('error', err);
} else {
base.emit('data', { bytesWritten: stream.bytesWritten });
}
stream.write(str, function (err) {
if (err) {
base.emit('error', err);
} else {
base.emit('data', { bytesWritten: stream.bytesWritten });
}
});
}
process.nextTick(function () {
callback();

@@ -107,3 +112,5 @@ });

writeQueue.pause();
stream.destroy();
if (stream) {
stream.destroy();
}
base.emit('shutdown');

@@ -114,6 +121,12 @@ };

writeQueue.pause();
stream.destroySoon();
if (stream) {
stream.destroy();
}
base.emit('shutdown');
};
function join(cb) {
writeQueue.join(cb);
}
return _.extend({}, {

@@ -126,3 +139,4 @@ stream,

destroy,
destroySoon
destroySoon,
join
}, base);

@@ -129,0 +143,0 @@ }

{
"name": "bunyan-rotating-file-stream",
"version": "1.1.0",
"version": "1.1.1",
"description": "a rotating file stream for the bunyan logging system",

@@ -5,0 +5,0 @@ "author": "Jim Tupper <npm@tupper.org.uk> (http://github.com/rcomian)",

@@ -31,3 +31,3 @@ var bunyan = require('bunyan');

var i = 0;
var batch = _.extend({}, { size: 8 }, options.batch);
var batch = _.extend({}, { size: 100 }, options.batch);

@@ -42,4 +42,6 @@ var ia = setInterval(function () {

ia = null;
rfs.destroy();
next();
rfs.join(function () {
rfs.destroy();
next();
});
return;

@@ -46,0 +48,0 @@ }

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