Name: js-handler/node_modules/restify/node_modules/bunyan/examples/src.js
| 1: | // Show the usage of `src: true` config option to get log call source info in |
| 2: | // log records (the `src` field). |
| 3: | |
| 4: | var Logger = require('../lib/bunyan'); |
| 5: | |
| 6: | var log = new Logger({name: 'src-example', src: true}); |
| 7: | |
| 8: | log.info('one'); |
| 9: | log.info('two'); |
| 10: | function doSomeFoo() { |
| 11: | log.info({foo:'bar'}, 'three'); |
| 12: | } |
| 13: | doSomeFoo(); |
| 14: | |
| 15: | function Wuzzle(options) { |
| 16: | this.log = options.log; |
| 17: | this.log.info('creating a wuzzle') |
| 18: | } |
| 19: | Wuzzle.prototype.woos = function () { |
| 20: | this.log.warn('This wuzzle is woosey.') |
| 21: | } |
| 22: | |
| 23: | var wuzzle = new Wuzzle({log: log.child({component: 'wuzzle'})}); |
| 24: | wuzzle.woos(); |
| 25: | log.info('done with the wuzzle') |
