Skip to content

xavierchou/express-fluent-logger

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-fluent-logger

NPM Version NPM Downloads Build Status Test Coverage Code Climate NPM Dependency

NODEI NODEI Download

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

access logger middleware using fluentd for express.js

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%