node-bunyan-lite/examples/src.js

26 lines
623 B
JavaScript
Raw Normal View History

// Show the usage of `src: true` config option to get log call source info in
// log records (the `src` field).
var bunyan = require('../lib/bunyan');
var log = bunyan.createLogger({name: 'src-example', src: true});
2012-06-05 06:19:39 +00:00
log.info('one');
log.info('two');
function doSomeFoo() {
2013-03-29 00:42:32 +00:00
log.info({foo:'bar'}, 'three');
}
doSomeFoo();
function Wuzzle(options) {
2013-03-29 00:42:32 +00:00
this.log = options.log;
this.log.info('creating a wuzzle')
}
Wuzzle.prototype.woos = function () {
2013-03-29 00:42:32 +00:00
this.log.warn('This wuzzle is woosey.')
}
2012-06-05 06:19:39 +00:00
var wuzzle = new Wuzzle({log: log.child({component: 'wuzzle'})});
wuzzle.woos();
2012-06-05 06:19:39 +00:00
log.info('done with the wuzzle')