Socket
Socket
Sign inDemoInstall

logzio-nodejs

Package Overview
Dependencies
54
Maintainers
6
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.3 to 2.0.4

.github/workflows/git-secrets.yml

43

lib/logzio-nodejs.d.ts
interface ILoggerOptions {
token: string;
host?: string;
type?: string;
sendIntervalMs?: number;
bufferSize?: number;
debug?: boolean;
numberOfRetries?: number;
supressErrors?: boolean;
addTimestampWithNanoSecs?: boolean;
compress?: boolean;
internalLogger?: { log(message: string, ...args: any[]): any } & Record<string, any>;
protocol?: string;
port?: string;
timeout?: number;
sleepUntilNextRetry?: number;
callback?: (err: Error, bulk: object) => void;
extraFields?: {};
token: string;
host?: string;
type?: string;
sendIntervalMs?: number;
bufferSize?: number;
debug?: boolean;
numberOfRetries?: number;
supressErrors?: boolean;
addTimestampWithNanoSecs?: boolean;
compress?: boolean;
internalLogger?: { log(message: string, ...args: any[]): any } & Record<string, any>;
protocol?: string;
setUserAgent?: boolean;
port?: string;
timeout?: number;
sleepUntilNextRetry?: number;
callback?: (err: Error, bulk: object) => void;
extraFields?: {};
}
interface ILogzioLogger extends ILoggerOptions {
jsonToString(json: string): string;
log(msg: any, obj?: object): void;
close(): void;
sendAndClose(callback?: (error: Error, bulk: object) => void): void;
jsonToString(json: string): string;
log(msg: any, obj?: object): void;
close(): void;
sendAndClose(callback?: (error: Error, bulk: object) => void): void;
}

@@ -27,0 +28,0 @@

@@ -56,2 +56,3 @@ const request = require('request-promise');

callback = this._defaultCallback,
setUserAgent = true,
extraFields = {},

@@ -75,3 +76,3 @@ }) {

this.sleepUntilNextRetry = sleepUntilNextRetry;
this.setUserAgent = setUserAgent;
this.timer = null;

@@ -263,4 +264,4 @@ this.closed = false;

accept: '*/*',
'user-agent': USER_AGENT,
'content-type': 'text/plain',
...(this.setUserAgent ? { 'user-agent': USER_AGENT } : {}),
},

@@ -267,0 +268,0 @@ };

{
"name": "logzio-nodejs",
"description": "A nodejs implementation for sending logs to Logz.IO cloud service Copy of logzio-nodejs",
"version": "2.0.3",
"version": "2.0.4",
"author": "Gilly Barr <gilly@logz.io>",

@@ -26,3 +26,7 @@ "contributors": [

"email": "ronish31@gmail.com"
}
},
{
"name": "Anton Kolomiiets",
"email": "resdenia@gmail.com"
}
],

@@ -43,3 +47,3 @@ "repository": {

"lodash.assign": "4.2.0",
"moment": "^2.24.0",
"moment": "2.29.2",
"request": "^2.88.0",

@@ -46,0 +50,0 @@ "request-promise": "^4.2.4"

@@ -31,3 +31,3 @@ ![Build Status](https://travis-ci.org/logzio/logzio-nodejs.svg?branch=master)

**Note:** If logzio-js is used as part of a serverless service (AWS Lambda, Azure Functions, Google Cloud Functions, etc.), add `logger.sendAndClose()` at the end of the run.
**Note:** If logzio-js is used as part of a serverless service (AWS Lambda, Azure Functions, Google Cloud Functions, etc.), add `logger.sendAndClose()` at the end of the run. For example [sync Lambda](https://github.com/logzio/logzio-nodejs/blob/master/Serverless/lambda-sync.md) and [async Lambda](https://github.com/logzio/logzio-nodejs/blob/master/Serverless/lambda-async.md)

@@ -51,2 +51,3 @@ ## Options

* **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" , ... }`.

@@ -64,2 +65,8 @@

## Update log
**2.0.4**
- Add parameter to manage User-agent
**2.0.3**
- Add verbose logging to use in Azure serverless function
**2.0.2**

@@ -78,2 +85,5 @@ - Updated required fields for typescript

<details>
<summary markdown="span"> Expand to check old versions </summary>
**1.0.4 - 1.0.6**

@@ -144,4 +154,4 @@ - Upgrade dependencies due to security vulnerabilities

</details>
# Scripts

@@ -148,0 +158,0 @@

@@ -62,2 +62,21 @@ const sinon = require('sinon');

it('sends log without user-agent header', (done) => {
const logger = createLogger({
bufferSize: 1,
callback: onDone,
setUserAgent:false
});
sinon.spy(logger, '_tryToSend');
const logMsg = 'hello there from test';
logger.log(logMsg);
function onDone() {
assert.equal(logger._tryToSend.getCall(0).args[0].headers['user-agent'], undefined);
logger._tryToSend.restore();
logger.close();
done();
}
});
it('should send a log with an object as additional param', (done) => {

@@ -64,0 +83,0 @@ const logger = createLogger({

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc