Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
node-gelf - Graylog2 client library for Node.js. Pro - because of code-quality. GELF - The Graylog Extended Log Format.
"dependencies": {
"gelf-pro": "~0.8" // see the "releases" section
}
npm install gelf-pro
var log = require('gelf-pro');
// simple
log.setConfig({host: 'my.glog-server.net'});
// advanced
log.setConfig({
fields: {facility: "example", owner: "Tom (a cat)"}, // optional; default fields for all messages
filter: [], // optional; filters to discard a message
broadcast: [], // optional; listeners of a message
levels: {}, // optional; default: see the levels section below
adapterName: 'udp', // optional; currently supported "udp" and "tcp"; default: udp
adapterOptions: {
protocol: 'udp4', // udp only; optional; udp adapter: udp4, udp6; default: udp4
family: 4, // tcp only; optional; version of IP stack; default: 4
host: '127.0.0.1', // optional; default: 127.0.0.1
port: 12201 // optional; default: 12201
}
});
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");
log.error('Oooops.', new Error('An error message'));
log.error(new Error('An error message'));
log.message(new Error('An error message'), 3);
In case extra
is a plain object,
the library converts it to a readable format. Other values are converted to string.
Acceptable format of a key is: ^[\w-]$
log.info(
'a new msg goes here',
{me: {fname: 'k', lname: 'k', bdate: new Date(2000, 01, 01)}}
);
// the extra becomes:
// {_me_fname: 'k', _me_lname: 'k', _me_bdate: 'Tue Feb 01 2000 00:00:00 GMT+0100 (CET)'}
Sometimes we have to discard a message which is not suitable for the current environment.
// it is not possible to modify the data.
log.setConfig({
filter: [
function (message) { // rejects a "debug" message
return (message.level < 7);
}
]
});
It is not possible to modify the data. broadcasting
happens after filtering
.
// it is not possible to modify the data.
log.setConfig({
broadcast: [
function (message) { // broadcasting to console
console[message.level > 3 ? 'log' : 'error'](message.short_message, message);
}
]
});
emergency
, alert
, critical
, error
, warning
(warn
), notice
, info
, debug
(log
)
npm install
npm test
[sudo] docker build --no-cache -t node-gelf-pro .
[sudo] docker run -ti --rm -v "${PWD}:/opt/app" -w "/opt/app" node-gelf-pro
The MIT License (MIT)
Copyright (c) 2013-2016 Kanstantsin Kamkou
FAQs
The Graylog Extended Log Format for the Node.js
The npm package gelf-pro receives a total of 14,140 weekly downloads. As such, gelf-pro popularity was classified as popular.
We found that gelf-pro demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.