logzio-nodejs
Advanced tools
Comparing version 2.1.7 to 2.1.8
@@ -14,3 +14,2 @@ interface ILoggerOptions { | ||
protocol?: string; | ||
setUserAgent?: boolean; | ||
port?: string; | ||
@@ -17,0 +16,0 @@ timeout?: number; |
@@ -38,3 +38,3 @@ const { networkInterfaces } = require('os'); | ||
const USER_AGENT = 'Logzio-Logger NodeJS'; | ||
const prop = require('../package.json'); | ||
@@ -59,3 +59,2 @@ class LogzioLogger { | ||
callback = this._defaultCallback, | ||
setUserAgent = true, | ||
extraFields = {}, | ||
@@ -79,3 +78,2 @@ }) { | ||
this.sleepUntilNextRetry = sleepUntilNextRetry; | ||
this.setUserAgent = setUserAgent; | ||
this.timer = null; | ||
@@ -93,3 +91,3 @@ this.closed = false; | ||
'Content-Type': 'text/plain', | ||
...(this.setUserAgent ? { 'user-agent': USER_AGENT } : {}), | ||
'user-agent': `NodeJS/${prop.version} logs`, | ||
...(this.compress ? { 'content-encoding': 'gzip' } : {}), | ||
@@ -96,0 +94,0 @@ |
{ | ||
"name": "logzio-nodejs", | ||
"description": "A nodejs implementation for sending logs to Logz.IO cloud service Copy of logzio-nodejs", | ||
"version": "2.1.7", | ||
"version": "2.1.8", | ||
"author": "Gilly Barr <gilly@logz.io>", | ||
@@ -6,0 +6,0 @@ "maintainers": [ |
@@ -52,3 +52,2 @@ ![Build Status](https://travis-ci.org/logzio/logzio-nodejs.svg?branch=master) | ||
* **internalLogger** - set internal logger that supports the function log. Default: console. | ||
* **setUserAgent** - Set `false` to send logs without user-agent field in request header. Default:`true`. | ||
* **extraFields** - Adds your own custom fields to each log. Add in JSON Format, for example: `extraFields : { field_1: "val_1", field_2: "val_2" , ... }`. | ||
@@ -66,2 +65,5 @@ | ||
## Update log | ||
**2.1.8** | ||
- Make `User-Agent` not optional and add the version to it. | ||
**2.1.7** | ||
@@ -68,0 +70,0 @@ - upgrade `axios` to `v1.6.4` (contributed by @gcagle3) |
@@ -10,2 +10,3 @@ const { networkInterfaces } = require('os'); | ||
const axiosInstance = require('../lib/axiosInstance.js'); | ||
const prop = require('../package.json'); | ||
axiosInstance.defaults.adapter = 'http'; | ||
@@ -65,7 +66,6 @@ | ||
it('sends log without user-agent header', (done) => { | ||
it('sends log with user-agent header', (done) => { | ||
const logger = createLogger({ | ||
bufferSize: 1, | ||
callback: onDone, | ||
setUserAgent:false | ||
callback: onDone | ||
}); | ||
@@ -78,3 +78,3 @@ sinon.spy(logger, '_tryToSend'); | ||
function onDone() { | ||
assert.equal(axiosInstance.defaults.headers.common['user-agent'], undefined); | ||
assert.equal(axiosInstance.defaults.headers.post['user-agent'], `NodeJS/${prop.version} logs`); | ||
logger._tryToSend.restore(); | ||
@@ -81,0 +81,0 @@ logger.close(); |
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
173
69230
952