Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"main": "dist/node.js",
"browser": "dist/client.js",
"scripts": {
"benchmark": "node test/benchmark",
"test": "npm run test:browser && npm run test:node && npm run test:leakage",
"tdd": "npm-run-all --parallel test:*:tdd",
"test:ci": "npm run test:browser && npm run test:node:ci",
Expand Down Expand Up @@ -87,6 +88,7 @@
"babel-polyfill": "6.20.0",
"babel-preset-es2015": "6.18.0",
"babel-preset-stage-0": "6.16.0",
"benchmark": "2.1.3",
"chai": "3.5.0",
"coveralls": "2.11.15",
"documentation": "4.0.0-beta11",
Expand Down
35 changes: 35 additions & 0 deletions test/benchmark/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* eslint-disable no-console */

const Benchmark = require('benchmark')
const bunyan = require('bunyan');
const WeLogger = require('../..');

var suite = new Benchmark.Suite();

const weLogger = new WeLogger({ stdout: false });
const bunyanLogger = bunyan.createLogger({ name: 'bunyan', streams: [] });

suite
.add('we-js-logger', function() {
weLogger.info('hello world')
})
.add('we-js-logger child', function() {
const log = weLogger.child();
log.info('hello world');
})
.add('bunyan', function() {
bunyanLogger.info('hello world');
})
.add('bunyan child', function() {
const log = bunyanLogger.child();
log.info('hello world');
})
// add listeners
.on('cycle', function(event) {
console.log(String(event.target));
})
.on('complete', function() {
console.log('Fastest is ' + this.filter('fastest').map('name'));
})
// run async
.run({ 'async': true });