-
Notifications
You must be signed in to change notification settings - Fork 888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No slowdown when logging through child loggers. #8
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
39309c9
No slowdown when logging through child loggers.
mcollina fa61e90
Faster child creation.
mcollina 51ff0e7
Support for serializers in child logger.
mcollina 8cac91b
Added README and final touches.
mcollina 0b5419b
From opts to bindings in child API.
mcollina File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,7 @@ node_modules | |
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# 0x | ||
.__browserify_string_empty.js | ||
profile-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
'use strict' | ||
|
||
var bench = require('fastbench') | ||
var pino = require('../') | ||
var bunyan = require('bunyan') | ||
var bole = require('bole')('bench') | ||
var winston = require('winston') | ||
var fs = require('fs') | ||
var dest = fs.createWriteStream('/dev/null') | ||
var plog = pino(dest) | ||
var max = 10 | ||
var blog = bunyan.createLogger({ | ||
name: 'myapp', | ||
streams: [{ | ||
level: 'trace', | ||
stream: dest | ||
}] | ||
}) | ||
|
||
require('bole').output({ | ||
level: 'info', | ||
stream: dest | ||
}) | ||
|
||
winston.add(winston.transports.File, { filename: '/dev/null' }) | ||
winston.remove(winston.transports.Console) | ||
|
||
var run = bench([ | ||
function benchBunyan (cb) { | ||
for (var i = 0; i < max; i++) { | ||
blog.info('hello world') | ||
} | ||
setImmediate(cb) | ||
}, | ||
function benchWinston (cb) { | ||
for (var i = 0; i < max; i++) { | ||
winston.info('hello world') | ||
} | ||
setImmediate(cb) | ||
}, | ||
function benchBole (cb) { | ||
for (var i = 0; i < max; i++) { | ||
bole.info('hello world') | ||
} | ||
setImmediate(cb) | ||
}, | ||
function benchPino (cb) { | ||
for (var i = 0; i < max; i++) { | ||
plog.info('hello world') | ||
} | ||
setImmediate(cb) | ||
} | ||
], 10000) | ||
|
||
run(run) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
'use strict' | ||
|
||
var bench = require('fastbench') | ||
var pino = require('../') | ||
var bunyan = require('bunyan') | ||
var bole = require('bole')('bench')('child') | ||
var fs = require('fs') | ||
var dest = fs.createWriteStream('/dev/null') | ||
var plog = pino(dest).child({ a: 'property' }) | ||
var max = 10 | ||
var blog = bunyan.createLogger({ | ||
name: 'myapp', | ||
streams: [{ | ||
level: 'trace', | ||
stream: dest | ||
}] | ||
}).child({ a: 'property' }) | ||
|
||
require('bole').output({ | ||
level: 'info', | ||
stream: dest | ||
}) | ||
|
||
var run = bench([ | ||
function benchBunyanObj (cb) { | ||
for (var i = 0; i < max; i++) { | ||
blog.info({ hello: 'world' }) | ||
} | ||
setImmediate(cb) | ||
}, | ||
function benchPinoChild (cb) { | ||
for (var i = 0; i < max; i++) { | ||
plog.info({ hello: 'world' }) | ||
} | ||
setImmediate(cb) | ||
}, | ||
function benchBoleChild (cb) { | ||
for (var i = 0; i < max; i++) { | ||
bole.info({ hello: 'world' }) | ||
} | ||
setImmediate(cb) | ||
} | ||
], 10000) | ||
|
||
run(run) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
'use strict' | ||
|
||
var bench = require('fastbench') | ||
var pino = require('../') | ||
var bunyan = require('bunyan') | ||
var bole = require('bole')('bench') | ||
var fs = require('fs') | ||
var dest = fs.createWriteStream('/dev/null') | ||
var plog = pino(dest) | ||
var max = 10 | ||
var blog = bunyan.createLogger({ | ||
name: 'myapp', | ||
streams: [{ | ||
level: 'trace', | ||
stream: dest | ||
}] | ||
}) | ||
|
||
require('bole').output({ | ||
level: 'info', | ||
stream: dest | ||
}) | ||
|
||
var run = bench([ | ||
function benchPinoCreation (cb) { | ||
var child = plog.child({ a: 'property' }) | ||
for (var i = 0; i < max; i++) { | ||
child.info({ hello: 'world' }) | ||
} | ||
setImmediate(cb) | ||
}, | ||
function benchBunyanCreation (cb) { | ||
var child = blog.child({ a: 'property' }) | ||
for (var i = 0; i < max; i++) { | ||
child.info({ hello: 'world' }) | ||
} | ||
setImmediate(cb) | ||
}, | ||
function benchBoleCreation (cb) { | ||
var child = bole('child') | ||
for (var i = 0; i < max; i++) { | ||
child.info({ hello: 'world' }) | ||
} | ||
setImmediate(cb) | ||
} | ||
], 10000) | ||
|
||
run(run) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be leverages shouldn't it?