fluent-logger
Advanced tools
Comparing version 3.0.0 to 3.1.0
@@ -42,3 +42,3 @@ 'use strict'; | ||
this._flushInterval = options.flushInterval || 100; | ||
this._sendQueueSizeLimit = 8 * 1024 * 1024; // 8MiB | ||
this._sendQueueSizeLimit = options.sendQueueSizeLimit || 8 * 1024 * 1024; // 8MiB | ||
this._sendQueueSize = 0; | ||
@@ -45,0 +45,0 @@ this._flushSendQueueTimeoutId = null; |
@@ -12,13 +12,24 @@ 'use strict'; | ||
module.exports = class FluentTransport extends Transport { | ||
constructor(options = {}) { | ||
constructor(_tag = DEFAULT_TAG, _options = {}) { | ||
// following check is to maintain compatibility with code that | ||
// uses the :tag parameter as the options object, | ||
// TODO: remove this check on major release | ||
const tagIsString = (typeof _tag === 'string'); | ||
const tagIsObject = (typeof _tag === 'object'); | ||
const tag = ( | ||
(tagIsString) | ||
? _tag | ||
: ( | ||
tagIsObject | ||
? (_tag.tag || DEFAULT_TAG) | ||
: null | ||
) | ||
); | ||
const options = ( | ||
(tagIsObject) | ||
? _tag | ||
: (_options || {}) | ||
); | ||
super(options); | ||
this.name = 'fluent'; | ||
let tag; | ||
if (options.tag) { | ||
tag = options.tag; | ||
} else { | ||
tag = DEFAULT_TAG; | ||
} | ||
this.sender = new FluentSender(tag, options); | ||
@@ -25,0 +36,0 @@ } |
{ | ||
"name": "fluent-logger", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -221,2 +221,4 @@ # fluent-logger for Node.js | ||
**NOTE** If you use `winston@2`, you can use `fluent-logger@2.7.0` or earlier. If you use `winston@3`, you can use `fluent-logger@2.8` or later. | ||
### stream | ||
@@ -300,3 +302,3 @@ | ||
Set flush interval in milliseconds. This option has no effect in Message mode. | ||
Set flush interval in milliseconds. This option has no effect in `Message` mode. | ||
The logger stores emitted events in buffer and flush events for each interval. | ||
@@ -321,2 +323,6 @@ Default `100`. | ||
**sendQueueSizeLimit** | ||
Queue size limit in bytes. This option has no effect in `Message` mode. Default is `8 MiB`. | ||
**tls** | ||
@@ -339,2 +345,8 @@ | ||
## Examples | ||
### Winston Integration | ||
An example of integrating with Winston can be found at [`./example/winston`](./example/winston). | ||
You will need Docker Compose to run it. After navigating to `./example/winston`, run `docker-compose up` and then `node index.js`. You should see the Docker logs having an `"it works"` message being output to FluentD. | ||
## License | ||
@@ -341,0 +353,0 @@ |
@@ -546,2 +546,12 @@ 'use strict'; | ||
it('should set sendQueueSizeLimit', (done) => { | ||
const s = new FluentSender('debug', Object.assign({}, clientOptions, { | ||
sendQueueSizeLimit: 1000, | ||
eventMode: 'PackedForward' | ||
})); | ||
expect(s._sendQueueSizeLimit).to.be.equal(1000); | ||
done(); | ||
}); | ||
// Internal behavior test. | ||
@@ -548,0 +558,0 @@ it('should not flush queue if existing connection is unavailable.', (done) => { |
@@ -18,3 +18,2 @@ 'use strict'; | ||
describe('transport', () => { | ||
it('should send log records', (done) => { | ||
@@ -21,0 +20,0 @@ runServer({}, {}, (server, finish) => { |
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
20
1939
358
118428