Name: js-handler/node_modules/restify/node_modules/bunyan/tools/timeguard.js 
1:
#!/usr/bin/env node
2:
/*
3:
 * Time logging with/without a try/catch-guard on the JSON.stringify.
4:
 */
5:
 
6:
console.log('Time try/catch-guard on JSON.stringify:');
7:
 
8:
var ben = require('ben');  // npm install ben
9:
var Logger = require('../lib/bunyan');
10:
 
11:
var records = [];
12:
function Collector() {
13:
}
14:
Collector.prototype.write = function (s) {
15:
    //records.push(s);
16:
}
17:
var collector = new Collector();
18:
 
19:
var log = new Logger({
20:
    name: 'timeguard',
21:
    src: true,
22:
    stream: collector
23:
});
24:
 
25:
var ms = ben(1e5, function () {
26:
    log.info('hi');
27:
});
28:
console.log(' - log.info:  %dms per iteration', ms);