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 0.1.0 to 0.1.1

.travis.yml

4

lib/adapter/abstract.js

@@ -13,3 +13,5 @@ /**

// the abstract class without prototype
var abstract = Object.create(null, {options: {writable: true, value: {}}});
var abstract = Object.create(null, {
options: {enumerable: true, writable: true, value: {}}
});

@@ -16,0 +18,0 @@ /**

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

metadata: {
enumerable: true,
value: {

@@ -26,0 +27,0 @@ magicBytes: [0x1e, 0x0f],

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

specification: {
enumerable: true,
value: {

@@ -23,4 +24,6 @@ version: '1.1',

config: {
enumerable: true,
writable: true,
value: {
fields: {},
adapterName: 'udp',

@@ -36,3 +39,3 @@ adapterOptions: {

// the adapter holder
// the adapter holder (opened on test purpose)
gelf.adapter = null;

@@ -83,8 +86,10 @@

['full_message', 'short_message', 'level'].forEach(function (key) {
if (!_.isUndefined(obj[key])) {
result[key] = obj[key];
delete obj[key];
}
});
// some fields should be copied without change
['full_message', 'short_message', 'level', 'host', 'timestamp']
.forEach(function (key) {
if (!_.isUndefined(obj[key])) {
result[key] = obj[key];
delete obj[key];
}
});

@@ -121,14 +126,26 @@ // recursion function for key-value aggregation

gelf.specification.levels.forEach(function (lvl, idx) {
gelf[lvl] = function (message, extra, cb) {
var self = this;
this[lvl] = function (message, extra, cb) {
// it is possible to skip the extra variable
if (_.isFunction(extra) && !cb) {
cb = extra;
extra = {};
}
// creating string from object
extra = gelf.getStringFromObject(_.merge({short_message: message, level: idx}, extra || {}));
extra = this.getStringFromObject(
_.merge(
{}, {short_message: message, level: idx},
this.config.fields, extra || {}
)
);
// runs before any other I/O events fire
process.nextTick(function () {
return gelf.send(extra, cb || _.noop);
return self.send(extra, cb || _.noop);
});
};
});
}.bind(gelf));
// exporting functionality outside
module.exports = gelf;
{
"name": "gelf-pro",
"version": "0.1.0",
"version": "0.1.1",
"main": "./lib/gelf-pro.js",

@@ -25,10 +25,10 @@ "author": "Kanstantsin Kamkou <kkamkou@gmail.com>",

"dependencies": {
"lodash": "2.4.*",
"async": "0.9.*"
"lodash": "2.4.1",
"async": "0.9.0"
},
"devDependencies": {
"should": "4.0.*",
"mocha": "1.20.*",
"sinon": "1.10.*"
"should": "4.0.1",
"mocha": "1.20.1",
"sinon": "1.10.2"
}
}

@@ -5,2 +5,4 @@ node-gelf

![Build Status](https://travis-ci.org/kkamkou/node-gelf-pro.svg?branch=master)
## Installation

@@ -19,8 +21,7 @@ ```

## API
#### Configuration
### Configuration
```javascript
var log = require('gelf-pro');
log.setConfig({
fields: {facility: "example", owner: "Tom (a cat)"},
adapterName: 'udp', // currently supported "udp" only

@@ -35,12 +36,16 @@ adapterOptions: {

#### Basic functionality
### Basic functionality
```javascript
var extra = {tom: 'cat', jerry: 'mouse', others: {spike: 1, tyke: 1}};
log.info("Hello world", extra, function (err, bytesSent) {});
log.info("Hello world", function (err, bytesSent) {});
log.info("Hello world", extra);
log.info("Hello world");
```
#### Levels
### Levels
```emergency```, ```alert```, ```critical```, ```error```, ```warning```, ```notice```, ```info```, ```debug```
#### Adapters
### Adapters

@@ -47,0 +52,0 @@ - UDP

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