Socket
Socket
Sign inDemoInstall

gelf-pro

Package Overview
Dependencies
2
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.2 to 1.2.0

2

lib/adapter/tcp.js

@@ -42,3 +42,3 @@ /**

.once('connect', function () {
var msg = new Buffer(message), // @todo! 1h add deflation with GELF 2.0
var msg = new Buffer(message.replace(/\x00/g, '')), // @todo! 1h add deflation with GELF 2.0
packet = new Buffer(Array.prototype.slice.call(msg, 0, msg.length).concat(0x00));

@@ -45,0 +45,0 @@ client.end(packet, function () {

@@ -39,2 +39,6 @@ /**

debug: 7
},
aliases: {
log: 'debug',
warn: 'warning'
}

@@ -148,3 +152,3 @@ }

if (!_.isUndefined(extra) && !_.isObjectLike(extra)) {
console.warn('Extra should be object-like or undefined');
console.warn('[gelf-pro]', 'extra should be object-like or undefined');
extra = {};

@@ -155,2 +159,6 @@ }

if (_.isError(message)) {
/* istanbul ignore else */
if (_.isEmpty(extra) && message.stack) {
extra = {full_message: message.stack};
}
message = message.message.toString() || 'Error';

@@ -162,4 +170,3 @@ }

// eslint-disable-next-line
extra = _.merge({}, {short_message: message, level: lvl}, this.config.fields, extra || {});
extra = _.merge({short_message: message, level: lvl}, this.config.fields, extra || {});

@@ -198,3 +205,3 @@ // filtering

// aliases to be console alike
_.forEach({log: 'debug', warn: 'warning'}, function (from, to) {
_.forEach(gelf.config.aliases, function (from, to) {
this[to] = this[from];

@@ -201,0 +208,0 @@ }.bind(gelf));

{
"name": "gelf-pro",
"version": "1.1.2",
"version": "1.2.0",
"main": "./lib/gelf-pro.js",

@@ -33,10 +33,10 @@ "types": "./lib/definition.d.ts",

"devDependencies": {
"coveralls": "^2.13.1",
"eslint": "^4.6.1",
"coveralls": "^2.13.3",
"eslint": "^4.10.0",
"istanbul": "^0.4.5",
"mocha": "^3.5.3",
"mocha": "^3.0.0-2",
"mocha-lcov-reporter": "^1.3.0",
"should": "^13.0.1",
"sinon": "^3.2.1"
"should": "^13.1.3",
"sinon": "^3.3.0"
}
}
node-gelf pro
====================
=============
node-gelf - Graylog2 client library for Node.js. Pro - because of code-quality. GELF - The Graylog Extended Log Format.

@@ -8,3 +8,2 @@

[![Code Climate](https://codeclimate.com/github/kkamkou/node-gelf-pro/badges/gpa.svg)](https://codeclimate.com/github/kkamkou/node-gelf-pro)
[![Dependency Status](https://www.versioneye.com/user/projects/56eca2764fb9b0000e68bce1/badge.svg?style=flat)](https://www.versioneye.com/user/projects/56eca2764fb9b0000e68bce1)

@@ -14,3 +13,3 @@ ## Installation

"dependencies": {
"gelf-pro": "~1.1" // see the "releases" section
"gelf-pro": "~1.2" // see the "releases" section
}

@@ -25,2 +24,11 @@ ```

### Adapters
- UDP (with deflation and chunking)
- Input: `GELF UDP`
- TCP
- Input: `GELF TCP` (with `Null frame delimiter`)
- TCP via TLS(SSL)
- Input: `GELF TCP` (with `Null frame delimiter` and `Enable TLS`)
### Configuration

@@ -38,2 +46,3 @@ ```javascript

levels: {}, // optional; default: see the levels section below
aliases: {}, // optional; default: see the aliases section below
adapterName: 'udp', // optional; currently supported "udp", "tcp" and "tcp-tls"; default: udp

@@ -73,3 +82,6 @@ adapterOptions: { // this object is passed to the adapter.connect() method

log.error('Oooops.', new Error('An error message'));
// ^-- extra becomes: {short_message: 'Oooops.', _error_message: 'An error message', _error_stack: Error's stack}
log.error(new Error('An error message'));
// ^-- extra becomes: {short_message: 'An error message', full_message: Error's stack}

@@ -88,4 +100,3 @@ log.message(new Error('An error message'), 3); // same as previous

);
// the extra becomes:
// {_me_fname: 'k', _me_lname: 'k', _me_bdate: 'Tue Feb 01 2000 00:00:00 GMT+0100 (CET)'}
// ^-- extra becomes: {_me_fname: 'k', _me_lname: 'k', _me_bdate: 'Tue Feb 01 2000 00:00:00 GMT+0100 (CET)'}
```

@@ -135,10 +146,14 @@

### Levels ([1](https://httpd.apache.org/docs/current/mod/core.html#loglevel), [2](https://logging.apache.org/log4j/2.0/log4j-api/apidocs/org/apache/logging/log4j/Level.html), [3](http://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels))
`emergency`, `alert`, `critical`, `error`, `warning` (`warn`), `notice`, `info`, `debug` (`log`)
### Adapters
Default:
`{emergency: 0, alert: 1, critical: 2, error: 3, warning: 4, notice: 5, info: 6, debug: 7}`
Example: `log.emergency(...)`, `log.critical(...)`, etc.
Custom example: `{alert: 0, notice: 1, ...}`
- UDP (with deflation and chunking)
- TCP
- TCP via TLS(SSL)
### Aliases
Default: `{log: 'debug', warn: 'warning'}`
Example: `log.log(...) -> log.debug(...)`, `log.warn(...) -> log.warning(...)`, etc.
Custom example: `{red: 'alert', yellow: 'notice', ...}`
### Tests

@@ -145,0 +160,0 @@ #### Cli

@@ -174,3 +174,3 @@ 'use strict';

JSON.parse(gelf.getStringFromObject.firstCall.returnValue)
.should.containEql({short_message: errSet[1]});
.should.containEql({short_message: errSet[1], full_message: err.stack});
JSON.parse(gelf.getStringFromObject.lastCall.returnValue)

@@ -184,3 +184,4 @@ .should.have.properties(['_error_message', '_error_stack']);

gelf = _.cloneDeep(gelfOriginal);
mock.expects('warn').once().withExactArgs('Extra should be object-like or undefined');
mock.expects('warn').once()
.withExactArgs('[gelf-pro]', 'extra should be object-like or undefined');
sinon.spy(gelf, 'getStringFromObject');

@@ -407,2 +408,12 @@ gelf.info('Bogus call', 'example');

'Remove null byte': function (done) {
this.eventEmitter.end.withArgs(new Buffer([0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x00])).callsArg(1);
this.adapter.send("\x00he\x00llo\x00", function (err, result) {
should.not.exists(err);
result.should.equal(6);
done();
});
this.eventEmitter.emit('connect');
},
'Connection timeout': function (done) {

@@ -409,0 +420,0 @@ this.eventEmitter.setTimeout.yieldsAsync();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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