Socket
Socket
Sign inDemoInstall

winston

Package Overview
Dependencies
Maintainers
4
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

winston - npm Package Compare versions

Comparing version 0.8.1 to 0.8.2

test/stress/http-server.js

13

CHANGELOG.md

@@ -0,1 +1,14 @@

## 0.8.2 / 2014-11-04
* [Full fix for #296 with proper streams2 detection with `isstream` for file transport (`jcrugzz`)](https://github.com/flatiron/winston/commit/5c4bd4191468570e46805ed399cad63cfb1856cc)
* [Add isstream module (`jcrugzz`)](https://github.com/flatiron/winston/commit/498b216d0199aebaef72ee4d8659a00fb737b9ae)
* [Partially fix #296 with streams2 detection for file transport (`indexzero`)](https://github.com/flatiron/winston/commit/b0227b6c27cf651ffa8b8192ef79ab24296362e3)
* [add stress test for issue #288 (`indexzero`)](https://github.com/flatiron/winston/commit/e08e504b5b3a00f0acaade75c5ba69e6439c84a6)
* [lessen timeouts to check test sanity (`indexzero`)](https://github.com/flatiron/winston/commit/e925f5bc398a88464f3e796545ff88912aff7568)
* [update winston-graylog2 documentation (`unlucio`)](https://github.com/flatiron/winston/commit/49fa86c31baf12c8ac3adced3bdba6deeea2e363)
* [fix test formatting (`indexzero`)](https://github.com/flatiron/winston/commit/8e2225799520a4598044cdf93006d216812a27f9)
* [fix so options are not redefined (`indexzero`)](https://github.com/flatiron/winston/commit/d1d146e8a5bb73dcb01579ad433f6d4f70b668ea)
* [fix self/this issue that broke `http` transport (`indexzero`)](https://github.com/flatiron/winston/commit/d10cbc07755c853b60729ab0cd14aa665da2a63b)
## 0.8.1 / 2014-10-06

@@ -2,0 +15,0 @@

27

docs/transports.md

@@ -304,4 +304,4 @@ # Winston Transports

``` js
var Graylog2 = require('winston-graylog2').Graylog2;
winston.add(Graylog2, options);
var winston = require('winston');
winston.add(require('winston-graylog2'), options);
```

@@ -311,12 +311,15 @@

* __level:__ Level of messages this transport should log. (default: info)
* __silent:__ Boolean flag indicating whether to suppress output. (default: false)
* __name__: Transport name
* __level__: Level of messages this transport should log. (default: info)
* __silent__: Boolean flag indicating whether to suppress output. (default: false)
* __handleExceptions__: Boolean flag, whenever to handle uncaught exceptions. (default: false)
* __graylog__:
- __servers__; list of graylog2 servers
* __host__: your server address (default: localhost)
* __port__: your server port (default: 12201)
- __hostname__: the name of this host (default: os.hostname())
- __facility__: the facility for these log messages (default: "Node.js")
- __bufferSize__: max UDP packet size, should never exceed the MTU of your system (default: 1400)
* __graylogHost:__ IP address or hostname of the graylog2 server. (default: localhost)
* __graylogPort:__ Port to send messages to on the graylog2 server. (default: 12201)
* __graylogHostname:__ The hostname associated with graylog2 messages. (default: require('os').hostname())
* __graylogFacility:__ The graylog2 facility to send log messages.. (default: nodejs)
*Metadata:* Stringified as JSON in the full message GELF field.
### Cassandra Transport

@@ -397,3 +400,3 @@

[18]: https://github.com/jesseditson/winston-sns
[19]: https://github.com/flite/winston-graylog2
[19]: https://github.com/namshi/winston-graylog2
[20]: https://github.com/jorgebay/winston-cassandra

@@ -16,2 +16,3 @@ /*

Transport = require('./transport').Transport,
isWritable = require('isStream').isWritable,
Stream = require('stream').Stream;

@@ -57,3 +58,3 @@

this._stream = options.stream;
this._isStreams2 = isWritable(this._stream);
//

@@ -171,2 +172,9 @@ // We need to listen for drain events when

File.prototype._write = function(data, callback) {
if (this._isStreams2) {
this._stream.write(data);
return callback && process.nextTick(function () {
callback(null, true);
});
}
// If this is a file write stream, we could use the builtin

@@ -182,3 +190,5 @@ // callback functionality, however, the stream is not guaranteed

}
callback(null, true);
process.nextTick(function () {
callback(null, true);
});
};

@@ -302,7 +312,7 @@

stream.destroy = common.tailFile(tail, function (err, line) {
if(err){
return stream.emit('error',err);
}
try {

@@ -439,3 +449,3 @@ stream.emit('data', line);

self._stream = fs.createWriteStream(fullname, self.options);
self._isStreams2 = isWritable(self._stream);
//

@@ -442,0 +452,0 @@ // We need to listen for drain events when

@@ -44,4 +44,5 @@ var util = require('util'),

Http.prototype._request = function (options, callback) {
var options = options || {},
auth = options.auth || this.auth,
options = options || {};
var auth = options.auth || this.auth,
path = options.path || this.path || '';

@@ -53,3 +54,3 @@

// Prepare options for outgoing HTTP request
req = (self.ssl ? https : http).request({
req = (this.ssl ? https : http).request({
host: this.host,

@@ -66,3 +67,2 @@ port: this.port,

req.on('error', callback);
req.on('response', function (res) {

@@ -69,0 +69,0 @@ res.on('end', function () {

{
"name": "winston",
"description": "A multi-transport async logging library for Node.js",
"version": "0.8.1",
"version": "0.8.2",
"author": "Nodejitsu Inc. <info@nodejitsu.com>",

@@ -23,2 +23,3 @@ "maintainers": [

"eyes": "0.1.x",
"isstream": "0.1.x",
"pkginfo": "0.3.x",

@@ -25,0 +26,0 @@ "stack-trace": "0.0.x"

@@ -164,3 +164,3 @@ /*

});
}, 1000);
}, 500);
},

@@ -180,3 +180,3 @@ "should respond with the appropriate message": function (err, level, msg, meta, logger) {

timer.done();
}, 1000);
}, 500);
},

@@ -183,0 +183,0 @@ "should respond with the appropriate message": function (err, transport, level, msg, meta) {

@@ -9,54 +9,50 @@ /*

!function (assert, fs, os, path, vows, winston) {
'use strict';
var assert = require('assert'),
fs = require('fs'),
os = require('os'),
path = require('path'),
vows = require('vows'),
winston = require('../../lib/winston');
vows.describe('winston/transports/file').addBatch({
'An instance of the File Transport': {
topic: function () {
var callback = this.callback.bind(this),
logPath = path.resolve(__dirname, '../fixtures/logs/file-open-test.log');
vows.describe('winston/transports/file').addBatch({
'An instance of the File Transport': {
topic: function () {
var callback = this.callback.bind(this),
logPath = path.resolve(__dirname, '../fixtures/logs/file-open-test.log');
try {
fs.unlinkSync(logPath);
} catch (ex) {
if (ex && ex.code !== 'ENOENT') { return callback(ex); }
}
try {
fs.unlinkSync(logPath);
} catch (ex) {
if (ex && ex.code !== 'ENOENT') { return callback(ex); }
}
var fileTransport = new (winston.transports.File)({
filename: logPath
}),
logger = new (winston.Logger)({
transports: [fileTransport]
}),
timeline = {};
var fileTransport = new (winston.transports.File)({
filename: logPath
}),
logger = new (winston.Logger)({
transports: [fileTransport]
}),
timeline = {};
fileTransport.open(function () {
timeline.open = Date.now();
fileTransport.open(function () {
timeline.open = Date.now();
setTimeout(function () {
logger.info('Hello, World!', function () {
timeline.logged = Date.now();
});
}, 100);
setTimeout(function () {
logger.info('Hello, World!', function () {
timeline.logged = Date.now();
});
}, 100);
setTimeout(function () {
callback(null, timeline);
}, 1000);
});
},
'should fire "open" event': function (results) {
assert.isTrue(!!results.open);
},
'should fire "logged" event': function (results) {
assert.isTrue(!!results.logged);
}
setTimeout(function () {
callback(null, timeline);
}, 1000);
});
},
'should fire "open" event': function (results) {
assert.isTrue(!!results.open);
},
'should fire "logged" event': function (results) {
assert.isTrue(!!results.logged);
}
}).export(module);
}(
require('assert'),
require('fs'),
require('os'),
require('path'),
require('vows'),
require('../../lib/winston')
);
}
}).export(module);

@@ -9,69 +9,65 @@ /*

!function (assert, fs, os, path, vows, winston) {
'use strict';
var assert = require('assert'),
fs = require('fs'),
os = require('os'),
path = require('path'),
vows = require('vows'),
winston = require('../../lib/winston');
vows.describe('winston/transports/file').addBatch({
'A stressed instance of the File Transport': {
topic: function () {
var callback = this.callback.bind(this),
logPath = path.resolve(__dirname, '../fixtures/logs/file-stress-test.log');
vows.describe('winston/transports/file').addBatch({
'A stressed instance of the File Transport': {
topic: function () {
var callback = this.callback.bind(this),
logPath = path.resolve(__dirname, '../fixtures/logs/file-stress-test.log');
try {
fs.unlinkSync(logPath);
} catch (ex) {
if (ex && ex.code !== 'ENOENT') { return callback(ex); }
}
try {
fs.unlinkSync(logPath);
} catch (ex) {
if (ex && ex.code !== 'ENOENT') { return callback(ex); }
}
var fileTransport = new (winston.transports.File)({
filename: logPath
}),
logger = new (winston.Logger)({
transports: [fileTransport]
});
var fileTransport = new (winston.transports.File)({
filename: logPath
}),
logger = new (winston.Logger)({
transports: [fileTransport]
});
fileTransport.on('open', function () {
setTimeout(function () {
clearInterval(interval);
fileTransport.on('open', function () {
setTimeout(function () {
clearInterval(interval);
logger.query({ order: 'asc' }, function (err, results) {
callback(null, results);
});
}, 100);
});
logger.query({ order: 'asc' }, function (err, results) {
callback(null, results);
});
}, 100);
});
var logIndex = 0,
interval = setInterval(function () {
logger.info(++logIndex);
stress(200);
}, 0);
var logIndex = 0,
interval = setInterval(function () {
logger.info(++logIndex);
stress(200);
}, 0);
logger.info(++logIndex);
stress(200);
logger.info(++logIndex);
stress(200);
function stress(duration) {
var startTime = Date.now();
function stress(duration) {
var startTime = Date.now();
while (Date.now() - startTime < duration) {
Math.sqrt(Math.PI);
}
while (Date.now() - startTime < duration) {
Math.sqrt(Math.PI);
}
},
'should not skip any log lines': function (results) {
var testIndex = 0;
}
},
'should not skip any log lines': function (results) {
var testIndex = 0;
results.file.forEach(function (log) {
if (+log.message !== ++testIndex) {
throw new Error('Number skipped');
}
});
}
results.file.forEach(function (log) {
if (+log.message !== ++testIndex) {
throw new Error('Number skipped');
}
});
}
}).export(module);
}(
require('assert'),
require('fs'),
require('os'),
require('path'),
require('vows'),
require('../../lib/winston')
);
}
}).export(module);
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