ongoworks:bunyan-logger

v2.5.0Published 9 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

Add and export the Bunyan logging module, also add the browserify client and bunyan-prettystream.

`meteor add ongoworks:bunyan-logger`

Adds bunyan-prettystream for pretty-printed bunyan Meteor output.

Adds bunyan-format for formatting bunyan Meteor output.

Note: This version has a breaking change. v1.4.0 used bunyan-pretty which was preventing windows compilation.

Server

The package exports logger.bunyan and logger.bunyanPrettyStream.

logger = {};
logger.bunyan = Npm.require('bunyan');
logger.bunyanPrettyStream = Npm.require('bunyan-prettystream');
logger.format = Npm.require('bunyan-format');

Example pure bunyan implementation in your application:

log = logger.bunyan.createLogger({name:'your-app'});

Example bunyan-pretty implemention in your application as:

log = logger.bunyan.createLogger({
  name: 'your-app',
  stream: process.stdout.isTTY ? new logger.bunyanPrettyStream(process.stdout) : process.stdout,
  level: 'info'
})

And add logging:

log.info("Something informative");

Client

The package exports bunyan to the client.

var log = bunyan.createLogger({name: 'play', level: 'debug'});
log.trace('this one does not emit');
log.debug('hi on debug');   // console.log