Add and export the Bunyan logging module, also add the browserify client, bunyan-prettystream, and bunyan-pretty.
`meteor add ongoworks:bunyan-logger`
Adds: bunyan-prettystream and bunyan-pretty for pretty-printed bunyan Meteor output.
The package exports logger.bunyan
, logger.bunyanPrettyStream
and logger.bunyanPretty
.
NOTE: logger.bunyanPretty
can cause issues when running on Windows
logger = {};
logger.bunyan = Npm.require('bunyan');
logger.bunyanPrettyStream = Npm.require('bunyan-prettystream')
logger.bunyanPretty = Npm.require('bunyan-pretty');
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");
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