npm

Don't miss out on this year's npm Pride t-shirt designs!Order your favorites here »

express-fluent-logger

0.3.3 • Public • Published

express-fluent-logger

NPM Version NPM Downloads Build Status Test Coverage Maintainability NPM Dependency Known Vulnerabilities

access logger middleware using fluentd for express.js

Install

$ npm install express-fluent-logger

Example

var app = require('express')();
var logger = require('express-fluent-logger');
 
app.use(logger());
 
app.get('/', function(req, res) {
  res.send('hello world!');
});
 
app.listen(3000);

Parameters

  • tag: String of tag name on fluentd. (default: debug)
  • options: Object of fluentd connection. (default: { host: '127.0.0.1', port: 24224, timeout: 3.0 })

Logging HTTP response headers

This middleware will record the http response header, if you specify options.responseHeaders as following.

var app = require('express')();
var logger = require('express-fluent-logger');
 
app.use(logger('tagName', { host: '127.0.0.1', port: 24224, timeout: 3.0, responseHeaders: ['x-userid'] }));
 
app.get('/', function(req, res) {
  res.send('hello world!');
});
 
app.listen(3000);
 

Test

$ fluentd -c test/fluent.conf &
$ npm test

License

MIT

About NodeJS version

This package is compatible with NodeJS versions >= 6.

install

npm i express-fluent-logger

Downloadsweekly downloads

209

version

0.3.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability