node package manager
Don’t reinvent the wheel. Reuse code within your team. Create a free org »

shiny-es-logger

node-es-logger v0.3.1

Forked from https://github.com/kt3k/node-es-logger to add custom log function and allow dynamic type override

This module creates a bunyan logger instance with an output stream bound to elasticsearch instance with logstash compatible JSON format.

Example

var logger = require('es-logger').create({
 
    name: 'myapp',
    host: 'localhost:9200'
 
});
 
logger.log(type, {object: value});

This prints a JSON and also send it to elasticsearch instance at localhost:9200.

Use with bonsai.io.

var logger = require('es-logger').create({
 
    name: 'myapp',
    host: 'username:password@myapp-name-123456789.us-west-2.bonsai.io'
 
});
 
logger.info({value: 123}, 'message');

This prints a JSON and also send it to bonsai's elasticsearch instance at myapp-name-123456789.us-west-2.bonsai.io.

see bunyan's README for what interfaces the logger has.