lucide-node 0.0.1-security → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of lucide-node might be problematic. Click here for more details.
- package/.eslintignore +2 -0
- package/.eslintrc +8 -0
- package/.github/dependabot.yml +13 -0
- package/.github/workflows/bench.yml +61 -0
- package/.github/workflows/ci.yml +88 -0
- package/.github/workflows/lock-threads.yml +30 -0
- package/.github/workflows/target-main.yml +23 -0
- package/.nojekyll +0 -0
- package/.prettierignore +1 -0
- package/.taprc.yaml +8 -0
- package/CNAME +1 -0
- package/CONTRIBUTING.md +30 -0
- package/LICENSE +21 -0
- package/README.md +159 -3
- package/SECURITY.md +68 -0
- package/benchmarks/basic.bench.js +95 -0
- package/benchmarks/child-child.bench.js +52 -0
- package/benchmarks/child-creation.bench.js +73 -0
- package/benchmarks/child.bench.js +62 -0
- package/benchmarks/deep-object.bench.js +88 -0
- package/benchmarks/formatters.bench.js +50 -0
- package/benchmarks/internal/custom-levels.js +67 -0
- package/benchmarks/internal/just-pino-heavy.bench.js +76 -0
- package/benchmarks/internal/just-pino.bench.js +182 -0
- package/benchmarks/internal/parent-vs-child.bench.js +75 -0
- package/benchmarks/internal/redact.bench.js +86 -0
- package/benchmarks/long-string.bench.js +81 -0
- package/benchmarks/multi-arg.bench.js +193 -0
- package/benchmarks/multistream.js +98 -0
- package/benchmarks/object.bench.js +82 -0
- package/benchmarks/utils/generate-benchmark-doc.js +36 -0
- package/benchmarks/utils/runbench.js +138 -0
- package/benchmarks/utils/wrap-log-level.js +55 -0
- package/bin.js +6 -0
- package/browser.js +484 -0
- package/build/sync-version.js +10 -0
- package/docs/api.md +1487 -0
- package/docs/asynchronous.md +40 -0
- package/docs/benchmarks.md +55 -0
- package/docs/browser.md +227 -0
- package/docs/bundling.md +40 -0
- package/docs/child-loggers.md +95 -0
- package/docs/ecosystem.md +84 -0
- package/docs/help.md +345 -0
- package/docs/lts.md +64 -0
- package/docs/pretty.md +35 -0
- package/docs/redaction.md +135 -0
- package/docs/transports.md +1238 -0
- package/docs/web.md +269 -0
- package/docsify/sidebar.md +26 -0
- package/examples/basic.js +43 -0
- package/examples/transport.js +68 -0
- package/favicon-16x16.png +0 -0
- package/favicon-32x32.png +0 -0
- package/favicon.ico +0 -0
- package/file.js +12 -0
- package/inc-version.sh +42 -0
- package/index.html +55 -0
- package/lib/caller.js +30 -0
- package/lib/constants.js +28 -0
- package/lib/deprecations.js +8 -0
- package/lib/levels.js +241 -0
- package/lib/meta.js +3 -0
- package/lib/multistream.js +188 -0
- package/lib/proto.js +234 -0
- package/lib/redaction.js +118 -0
- package/lib/symbols.js +74 -0
- package/lib/time.js +11 -0
- package/lib/tools.js +394 -0
- package/lib/transport-stream.js +56 -0
- package/lib/transport.js +167 -0
- package/lib/worker.js +194 -0
- package/lib/writer.js +42 -0
- package/package.json +117 -3
- package/pino-banner.png +0 -0
- package/pino-logo-hire.png +0 -0
- package/pino-tree.png +0 -0
- package/pino.d.ts +889 -0
- package/pino.js +236 -0
- package/pretty-demo.png +0 -0
- package/test/basic.test.js +874 -0
- package/test/broken-pipe.test.js +57 -0
- package/test/browser-child.test.js +132 -0
- package/test/browser-disabled.test.js +87 -0
- package/test/browser-early-console-freeze.test.js +12 -0
- package/test/browser-levels.test.js +241 -0
- package/test/browser-serializers.test.js +352 -0
- package/test/browser-timestamp.test.js +88 -0
- package/test/browser-transmit.test.js +417 -0
- package/test/browser.test.js +659 -0
- package/test/complex-objects.test.js +34 -0
- package/test/crlf.test.js +32 -0
- package/test/custom-levels.test.js +253 -0
- package/test/error.test.js +398 -0
- package/test/errorKey.test.js +34 -0
- package/test/escaping.test.js +91 -0
- package/test/esm/esm.mjs +12 -0
- package/test/esm/index.test.js +34 -0
- package/test/esm/named-exports.mjs +27 -0
- package/test/exit.test.js +77 -0
- package/test/fixtures/broken-pipe/basic.js +9 -0
- package/test/fixtures/broken-pipe/destination.js +10 -0
- package/test/fixtures/broken-pipe/syncfalse.js +12 -0
- package/test/fixtures/console-transport.js +13 -0
- package/test/fixtures/default-exit.js +8 -0
- package/test/fixtures/destination-exit.js +8 -0
- package/test/fixtures/eval/index.js +13 -0
- package/test/fixtures/eval/node_modules/14-files.js +3 -0
- package/test/fixtures/eval/node_modules/2-files.js +3 -0
- package/test/fixtures/eval/node_modules/file1.js +5 -0
- package/test/fixtures/eval/node_modules/file10.js +5 -0
- package/test/fixtures/eval/node_modules/file11.js +5 -0
- package/test/fixtures/eval/node_modules/file12.js +5 -0
- package/test/fixtures/eval/node_modules/file13.js +5 -0
- package/test/fixtures/eval/node_modules/file14.js +11 -0
- package/test/fixtures/eval/node_modules/file2.js +5 -0
- package/test/fixtures/eval/node_modules/file3.js +5 -0
- package/test/fixtures/eval/node_modules/file4.js +5 -0
- package/test/fixtures/eval/node_modules/file5.js +5 -0
- package/test/fixtures/eval/node_modules/file6.js +5 -0
- package/test/fixtures/eval/node_modules/file7.js +5 -0
- package/test/fixtures/eval/node_modules/file8.js +5 -0
- package/test/fixtures/eval/node_modules/file9.js +5 -0
- package/test/fixtures/noop-transport.js +10 -0
- package/test/fixtures/pretty/null-prototype.js +8 -0
- package/test/fixtures/stdout-hack-protection.js +11 -0
- package/test/fixtures/syncfalse-child.js +6 -0
- package/test/fixtures/syncfalse-exit.js +9 -0
- package/test/fixtures/syncfalse-flush-exit.js +10 -0
- package/test/fixtures/syncfalse.js +6 -0
- package/test/fixtures/syntax-error-esm.mjs +2 -0
- package/test/fixtures/to-file-transport-with-transform.js +20 -0
- package/test/fixtures/to-file-transport.js +13 -0
- package/test/fixtures/to-file-transport.mjs +8 -0
- package/test/fixtures/transport/index.js +12 -0
- package/test/fixtures/transport/package.json +5 -0
- package/test/fixtures/transport-exit-immediately-with-async-dest.js +16 -0
- package/test/fixtures/transport-exit-immediately.js +11 -0
- package/test/fixtures/transport-exit-on-ready.js +12 -0
- package/test/fixtures/transport-main.js +9 -0
- package/test/fixtures/transport-many-lines.js +29 -0
- package/test/fixtures/transport-string-stdout.js +9 -0
- package/test/fixtures/transport-transform.js +21 -0
- package/test/fixtures/transport-uses-pino-config.js +33 -0
- package/test/fixtures/transport-with-on-exit.js +12 -0
- package/test/fixtures/transport-worker-data.js +19 -0
- package/test/fixtures/transport-worker.js +15 -0
- package/test/fixtures/transport-wrong-export-type.js +3 -0
- package/test/fixtures/ts/to-file-transport-with-transform.ts +18 -0
- package/test/fixtures/ts/to-file-transport.ts +11 -0
- package/test/fixtures/ts/transpile.cjs +36 -0
- package/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts +15 -0
- package/test/fixtures/ts/transport-exit-immediately.ts +10 -0
- package/test/fixtures/ts/transport-exit-on-ready.ts +11 -0
- package/test/fixtures/ts/transport-main.ts +8 -0
- package/test/fixtures/ts/transport-string-stdout.ts +8 -0
- package/test/fixtures/ts/transport-worker.ts +14 -0
- package/test/formatters.test.js +355 -0
- package/test/helper.d.ts +4 -0
- package/test/helper.js +128 -0
- package/test/hooks.test.js +118 -0
- package/test/http.test.js +242 -0
- package/test/internals/version.test.js +15 -0
- package/test/is-level-enabled.test.js +185 -0
- package/test/jest/basic.spec.js +10 -0
- package/test/levels.test.js +772 -0
- package/test/metadata.test.js +106 -0
- package/test/mixin-merge-strategy.test.js +55 -0
- package/test/mixin.test.js +218 -0
- package/test/multistream.test.js +673 -0
- package/test/pkg/index.js +46 -0
- package/test/pkg/pkg.config.json +17 -0
- package/test/pkg/pkg.test.js +56 -0
- package/test/redact.test.js +847 -0
- package/test/serializers.test.js +253 -0
- package/test/stdout-protection.test.js +39 -0
- package/test/syncfalse.test.js +188 -0
- package/test/timestamp.test.js +121 -0
- package/test/transport/big.test.js +43 -0
- package/test/transport/bundlers-support.test.js +97 -0
- package/test/transport/caller.test.js +23 -0
- package/test/transport/core.test.js +644 -0
- package/test/transport/core.test.ts +236 -0
- package/test/transport/core.transpiled.test.ts +112 -0
- package/test/transport/module-link.test.js +239 -0
- package/test/transport/pipeline.test.js +135 -0
- package/test/transport/repl.test.js +14 -0
- package/test/transport/syncTrue.test.js +55 -0
- package/test/transport/syncfalse.test.js +68 -0
- package/test/transport/targets.test.js +44 -0
- package/test/transport/uses-pino-config.test.js +167 -0
- package/test/transport-stream.test.js +26 -0
- package/test/types/pino-import.test-d.ts +29 -0
- package/test/types/pino-multistream.test-d.ts +28 -0
- package/test/types/pino-top-export.test-d.ts +35 -0
- package/test/types/pino-transport.test-d.ts +145 -0
- package/test/types/pino-type-only.test-d.ts +64 -0
- package/test/types/pino.test-d.ts +468 -0
- package/test/types/pino.ts +78 -0
- package/tsconfig.json +14 -0
@@ -0,0 +1,86 @@
|
|
1
|
+
'use strict'
|
2
|
+
|
3
|
+
const bench = require('fastbench')
|
4
|
+
const pino = require('../../')
|
5
|
+
const fs = require('node:fs')
|
6
|
+
const dest = fs.createWriteStream('/dev/null')
|
7
|
+
const plog = pino(dest)
|
8
|
+
delete require.cache[require.resolve('../../')]
|
9
|
+
const plogAsync = require('../../')(pino.destination({ dest: '/dev/null', sync: false }))
|
10
|
+
delete require.cache[require.resolve('../../')]
|
11
|
+
const plogUnsafe = require('../../')({ safe: false }, dest)
|
12
|
+
delete require.cache[require.resolve('../../')]
|
13
|
+
const plogUnsafeAsync = require('../../')(
|
14
|
+
{ safe: false },
|
15
|
+
pino.destination({ dest: '/dev/null', sync: false })
|
16
|
+
)
|
17
|
+
const plogRedact = pino({ redact: ['a.b.c'] }, dest)
|
18
|
+
delete require.cache[require.resolve('../../')]
|
19
|
+
const plogAsyncRedact = require('../../')(
|
20
|
+
{ redact: ['a.b.c'] },
|
21
|
+
pino.destination({ dest: '/dev/null', sync: false })
|
22
|
+
)
|
23
|
+
delete require.cache[require.resolve('../../')]
|
24
|
+
const plogUnsafeRedact = require('../../')({ redact: ['a.b.c'], safe: false }, dest)
|
25
|
+
delete require.cache[require.resolve('../../')]
|
26
|
+
const plogUnsafeAsyncRedact = require('../../')(
|
27
|
+
{ redact: ['a.b.c'], safe: false },
|
28
|
+
pino.destination({ dest: '/dev/null', sync: false })
|
29
|
+
)
|
30
|
+
|
31
|
+
const max = 10
|
32
|
+
|
33
|
+
// note that "redact me." is the same amount of bytes as the censor: "[Redacted]"
|
34
|
+
|
35
|
+
const run = bench([
|
36
|
+
function benchPinoNoRedact (cb) {
|
37
|
+
for (var i = 0; i < max; i++) {
|
38
|
+
plog.info({ a: { b: { c: 'redact me.', d: 'leave me' } } })
|
39
|
+
}
|
40
|
+
setImmediate(cb)
|
41
|
+
},
|
42
|
+
function benchPinoRedact (cb) {
|
43
|
+
for (var i = 0; i < max; i++) {
|
44
|
+
plogRedact.info({ a: { b: { c: 'redact me.', d: 'leave me' } } })
|
45
|
+
}
|
46
|
+
setImmediate(cb)
|
47
|
+
},
|
48
|
+
function benchPinoUnsafeNoRedact (cb) {
|
49
|
+
for (var i = 0; i < max; i++) {
|
50
|
+
plogUnsafe.info({ a: { b: { c: 'redact me.', d: 'leave me' } } })
|
51
|
+
}
|
52
|
+
setImmediate(cb)
|
53
|
+
},
|
54
|
+
function benchPinoUnsafeRedact (cb) {
|
55
|
+
for (var i = 0; i < max; i++) {
|
56
|
+
plogUnsafeRedact.info({ a: { b: { c: 'redact me.', d: 'leave me' } } })
|
57
|
+
}
|
58
|
+
setImmediate(cb)
|
59
|
+
},
|
60
|
+
function benchPinoAsyncNoRedact (cb) {
|
61
|
+
for (var i = 0; i < max; i++) {
|
62
|
+
plogAsync.info({ a: { b: { c: 'redact me.', d: 'leave me' } } })
|
63
|
+
}
|
64
|
+
setImmediate(cb)
|
65
|
+
},
|
66
|
+
function benchPinoAsyncRedact (cb) {
|
67
|
+
for (var i = 0; i < max; i++) {
|
68
|
+
plogAsyncRedact.info({ a: { b: { c: 'redact me.', d: 'leave me' } } })
|
69
|
+
}
|
70
|
+
setImmediate(cb)
|
71
|
+
},
|
72
|
+
function benchPinoUnsafeAsyncNoRedact (cb) {
|
73
|
+
for (var i = 0; i < max; i++) {
|
74
|
+
plogUnsafeAsync.info({ a: { b: { c: 'redact me.', d: 'leave me' } } })
|
75
|
+
}
|
76
|
+
setImmediate(cb)
|
77
|
+
},
|
78
|
+
function benchPinoUnsafeAsyncRedact (cb) {
|
79
|
+
for (var i = 0; i < max; i++) {
|
80
|
+
plogUnsafeAsyncRedact.info({ a: { b: { c: 'redact me.', d: 'leave me' } } })
|
81
|
+
}
|
82
|
+
setImmediate(cb)
|
83
|
+
}
|
84
|
+
], 10000)
|
85
|
+
|
86
|
+
run(run)
|
@@ -0,0 +1,81 @@
|
|
1
|
+
'use strict'
|
2
|
+
|
3
|
+
const bench = require('fastbench')
|
4
|
+
const pino = require('../')
|
5
|
+
const bunyan = require('bunyan')
|
6
|
+
const bole = require('bole')('bench')
|
7
|
+
const winston = require('winston')
|
8
|
+
const fs = require('node:fs')
|
9
|
+
const dest = fs.createWriteStream('/dev/null')
|
10
|
+
const plogNodeStream = pino(dest)
|
11
|
+
delete require.cache[require.resolve('../')]
|
12
|
+
const plogDest = require('../')(pino.destination('/dev/null'))
|
13
|
+
delete require.cache[require.resolve('../')]
|
14
|
+
const plogMinLength = require('../')(pino.destination({ dest: '/dev/null', sync: false, minLength: 4096 }))
|
15
|
+
|
16
|
+
const crypto = require('crypto')
|
17
|
+
|
18
|
+
const longStr = crypto.randomBytes(2000).toString()
|
19
|
+
|
20
|
+
const max = 10
|
21
|
+
const blog = bunyan.createLogger({
|
22
|
+
name: 'myapp',
|
23
|
+
streams: [{
|
24
|
+
level: 'trace',
|
25
|
+
stream: dest
|
26
|
+
}]
|
27
|
+
})
|
28
|
+
|
29
|
+
require('bole').output({
|
30
|
+
level: 'info',
|
31
|
+
stream: dest
|
32
|
+
}).setFastTime(true)
|
33
|
+
|
34
|
+
const chill = winston.createLogger({
|
35
|
+
transports: [
|
36
|
+
new winston.transports.Stream({
|
37
|
+
stream: fs.createWriteStream('/dev/null')
|
38
|
+
})
|
39
|
+
]
|
40
|
+
})
|
41
|
+
|
42
|
+
const run = bench([
|
43
|
+
function benchBunyan (cb) {
|
44
|
+
for (var i = 0; i < max; i++) {
|
45
|
+
blog.info(longStr)
|
46
|
+
}
|
47
|
+
setImmediate(cb)
|
48
|
+
},
|
49
|
+
function benchWinston (cb) {
|
50
|
+
for (var i = 0; i < max; i++) {
|
51
|
+
chill.info(longStr)
|
52
|
+
}
|
53
|
+
setImmediate(cb)
|
54
|
+
},
|
55
|
+
function benchBole (cb) {
|
56
|
+
for (var i = 0; i < max; i++) {
|
57
|
+
bole.info(longStr)
|
58
|
+
}
|
59
|
+
setImmediate(cb)
|
60
|
+
},
|
61
|
+
function benchPino (cb) {
|
62
|
+
for (var i = 0; i < max; i++) {
|
63
|
+
plogDest.info(longStr)
|
64
|
+
}
|
65
|
+
setImmediate(cb)
|
66
|
+
},
|
67
|
+
function benchPinoMinLength (cb) {
|
68
|
+
for (var i = 0; i < max; i++) {
|
69
|
+
plogMinLength.info(longStr)
|
70
|
+
}
|
71
|
+
setImmediate(cb)
|
72
|
+
},
|
73
|
+
function benchPinoNodeStream (cb) {
|
74
|
+
for (var i = 0; i < max; i++) {
|
75
|
+
plogNodeStream.info(longStr)
|
76
|
+
}
|
77
|
+
setImmediate(cb)
|
78
|
+
}
|
79
|
+
], 1000)
|
80
|
+
|
81
|
+
run(run)
|
@@ -0,0 +1,193 @@
|
|
1
|
+
'use strict'
|
2
|
+
|
3
|
+
const bench = require('fastbench')
|
4
|
+
const pino = require('../')
|
5
|
+
const bunyan = require('bunyan')
|
6
|
+
const bole = require('bole')('bench')
|
7
|
+
const winston = require('winston')
|
8
|
+
const fs = require('node:fs')
|
9
|
+
const dest = fs.createWriteStream('/dev/null')
|
10
|
+
const plogNodeStream = pino(dest)
|
11
|
+
delete require.cache[require.resolve('../')]
|
12
|
+
const plogDest = require('../')(pino.destination('/dev/null'))
|
13
|
+
delete require.cache[require.resolve('../')]
|
14
|
+
const plogMinLength = require('../')(pino.destination({ dest: '/dev/null', sync: false, minLength: 4096 }))
|
15
|
+
delete require.cache[require.resolve('../')]
|
16
|
+
|
17
|
+
const deep = require('../package.json')
|
18
|
+
deep.deep = Object.assign({}, JSON.parse(JSON.stringify(deep)))
|
19
|
+
deep.deep.deep = Object.assign({}, JSON.parse(JSON.stringify(deep)))
|
20
|
+
deep.deep.deep.deep = Object.assign({}, JSON.parse(JSON.stringify(deep)))
|
21
|
+
|
22
|
+
const blog = bunyan.createLogger({
|
23
|
+
name: 'myapp',
|
24
|
+
streams: [{
|
25
|
+
level: 'trace',
|
26
|
+
stream: dest
|
27
|
+
}]
|
28
|
+
})
|
29
|
+
|
30
|
+
require('bole').output({
|
31
|
+
level: 'info',
|
32
|
+
stream: dest
|
33
|
+
}).setFastTime(true)
|
34
|
+
|
35
|
+
const chill = winston.createLogger({
|
36
|
+
transports: [
|
37
|
+
new winston.transports.Stream({
|
38
|
+
stream: fs.createWriteStream('/dev/null')
|
39
|
+
})
|
40
|
+
]
|
41
|
+
})
|
42
|
+
|
43
|
+
const max = 10
|
44
|
+
|
45
|
+
const run = bench([
|
46
|
+
function benchBunyanInterpolate (cb) {
|
47
|
+
for (var i = 0; i < max; i++) {
|
48
|
+
blog.info('hello %s', 'world')
|
49
|
+
}
|
50
|
+
setImmediate(cb)
|
51
|
+
},
|
52
|
+
function benchWinstonInterpolate (cb) {
|
53
|
+
for (var i = 0; i < max; i++) {
|
54
|
+
chill.log('info', 'hello %s', 'world')
|
55
|
+
}
|
56
|
+
setImmediate(cb)
|
57
|
+
},
|
58
|
+
function benchBoleInterpolate (cb) {
|
59
|
+
for (var i = 0; i < max; i++) {
|
60
|
+
bole.info('hello %s', 'world')
|
61
|
+
}
|
62
|
+
setImmediate(cb)
|
63
|
+
},
|
64
|
+
function benchPinoInterpolate (cb) {
|
65
|
+
for (var i = 0; i < max; i++) {
|
66
|
+
plogDest.info('hello %s', 'world')
|
67
|
+
}
|
68
|
+
setImmediate(cb)
|
69
|
+
},
|
70
|
+
function benchPinoMinLengthInterpolate (cb) {
|
71
|
+
for (var i = 0; i < max; i++) {
|
72
|
+
plogMinLength.info('hello %s', 'world')
|
73
|
+
}
|
74
|
+
setImmediate(cb)
|
75
|
+
},
|
76
|
+
function benchPinoNodeStreamInterpolate (cb) {
|
77
|
+
for (var i = 0; i < max; i++) {
|
78
|
+
plogNodeStream.info('hello %s', 'world')
|
79
|
+
}
|
80
|
+
setImmediate(cb)
|
81
|
+
},
|
82
|
+
function benchBunyanInterpolateAll (cb) {
|
83
|
+
for (var i = 0; i < max; i++) {
|
84
|
+
blog.info('hello %s %j %d', 'world', { obj: true }, 4)
|
85
|
+
}
|
86
|
+
setImmediate(cb)
|
87
|
+
},
|
88
|
+
|
89
|
+
function benchWinstonInterpolateAll (cb) {
|
90
|
+
for (var i = 0; i < max; i++) {
|
91
|
+
chill.log('info', 'hello %s %j %d', 'world', { obj: true }, 4)
|
92
|
+
}
|
93
|
+
setImmediate(cb)
|
94
|
+
},
|
95
|
+
function benchBoleInterpolateAll (cb) {
|
96
|
+
for (var i = 0; i < max; i++) {
|
97
|
+
bole.info('hello %s %j %d', 'world', { obj: true }, 4)
|
98
|
+
}
|
99
|
+
setImmediate(cb)
|
100
|
+
},
|
101
|
+
function benchPinoInterpolateAll (cb) {
|
102
|
+
for (var i = 0; i < max; i++) {
|
103
|
+
plogDest.info('hello %s %j %d', 'world', { obj: true }, 4)
|
104
|
+
}
|
105
|
+
setImmediate(cb)
|
106
|
+
},
|
107
|
+
function benchPinoMinLengthInterpolateAll (cb) {
|
108
|
+
for (var i = 0; i < max; i++) {
|
109
|
+
plogMinLength.info('hello %s %j %d', 'world', { obj: true }, 4)
|
110
|
+
}
|
111
|
+
setImmediate(cb)
|
112
|
+
},
|
113
|
+
function benchPinoNodeStreamInterpolateAll (cb) {
|
114
|
+
for (var i = 0; i < max; i++) {
|
115
|
+
plogNodeStream.info('hello %s %j %d', 'world', { obj: true }, 4)
|
116
|
+
}
|
117
|
+
setImmediate(cb)
|
118
|
+
},
|
119
|
+
function benchBunyanInterpolateExtra (cb) {
|
120
|
+
for (var i = 0; i < max; i++) {
|
121
|
+
blog.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' })
|
122
|
+
}
|
123
|
+
setImmediate(cb)
|
124
|
+
},
|
125
|
+
function benchWinstonInterpolateExtra (cb) {
|
126
|
+
for (var i = 0; i < max; i++) {
|
127
|
+
chill.log('info', 'hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' })
|
128
|
+
}
|
129
|
+
setImmediate(cb)
|
130
|
+
},
|
131
|
+
function benchBoleInterpolateExtra (cb) {
|
132
|
+
for (var i = 0; i < max; i++) {
|
133
|
+
bole.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' })
|
134
|
+
}
|
135
|
+
setImmediate(cb)
|
136
|
+
},
|
137
|
+
function benchPinoInterpolateExtra (cb) {
|
138
|
+
for (var i = 0; i < max; i++) {
|
139
|
+
plogDest.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' })
|
140
|
+
}
|
141
|
+
setImmediate(cb)
|
142
|
+
},
|
143
|
+
function benchPinoMinLengthInterpolateExtra (cb) {
|
144
|
+
for (var i = 0; i < max; i++) {
|
145
|
+
plogMinLength.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' })
|
146
|
+
}
|
147
|
+
setImmediate(cb)
|
148
|
+
},
|
149
|
+
function benchPinoNodeStreamInterpolateExtra (cb) {
|
150
|
+
for (var i = 0; i < max; i++) {
|
151
|
+
plogNodeStream.info('hello %s %j %d', 'world', { obj: true }, 4, { another: 'obj' })
|
152
|
+
}
|
153
|
+
setImmediate(cb)
|
154
|
+
},
|
155
|
+
function benchBunyanInterpolateDeep (cb) {
|
156
|
+
for (var i = 0; i < max; i++) {
|
157
|
+
blog.info('hello %j', deep)
|
158
|
+
}
|
159
|
+
setImmediate(cb)
|
160
|
+
},
|
161
|
+
function benchWinstonInterpolateDeep (cb) {
|
162
|
+
for (var i = 0; i < max; i++) {
|
163
|
+
chill.log('info', 'hello %j', deep)
|
164
|
+
}
|
165
|
+
setImmediate(cb)
|
166
|
+
},
|
167
|
+
function benchBoleInterpolateDeep (cb) {
|
168
|
+
for (var i = 0; i < max; i++) {
|
169
|
+
bole.info('hello %j', deep)
|
170
|
+
}
|
171
|
+
setImmediate(cb)
|
172
|
+
},
|
173
|
+
function benchPinoInterpolateDeep (cb) {
|
174
|
+
for (var i = 0; i < max; i++) {
|
175
|
+
plogDest.info('hello %j', deep)
|
176
|
+
}
|
177
|
+
setImmediate(cb)
|
178
|
+
},
|
179
|
+
function benchPinoMinLengthInterpolateDeep (cb) {
|
180
|
+
for (var i = 0; i < max; i++) {
|
181
|
+
plogMinLength.info('hello %j', deep)
|
182
|
+
}
|
183
|
+
setImmediate(cb)
|
184
|
+
},
|
185
|
+
function benchPinoNodeStreamInterpolateDeep (cb) {
|
186
|
+
for (var i = 0; i < max; i++) {
|
187
|
+
plogNodeStream.info('hello %j', deep)
|
188
|
+
}
|
189
|
+
setImmediate(cb)
|
190
|
+
}
|
191
|
+
], 10000)
|
192
|
+
|
193
|
+
run(run)
|
@@ -0,0 +1,98 @@
|
|
1
|
+
'use strict'
|
2
|
+
|
3
|
+
const bench = require('fastbench')
|
4
|
+
const bunyan = require('bunyan')
|
5
|
+
const pino = require('../')
|
6
|
+
const fs = require('node:fs')
|
7
|
+
const dest = fs.createWriteStream('/dev/null')
|
8
|
+
|
9
|
+
const tenStreams = [
|
10
|
+
{ stream: dest },
|
11
|
+
{ stream: dest },
|
12
|
+
{ stream: dest },
|
13
|
+
{ stream: dest },
|
14
|
+
{ stream: dest },
|
15
|
+
{ level: 'debug', stream: dest },
|
16
|
+
{ level: 'debug', stream: dest },
|
17
|
+
{ level: 'trace', stream: dest },
|
18
|
+
{ level: 'warn', stream: dest },
|
19
|
+
{ level: 'fatal', stream: dest }
|
20
|
+
]
|
21
|
+
const pinomsTen = pino({ level: 'debug' }, pino.multistream(tenStreams))
|
22
|
+
|
23
|
+
const fourStreams = [
|
24
|
+
{ stream: dest },
|
25
|
+
{ stream: dest },
|
26
|
+
{ level: 'debug', stream: dest },
|
27
|
+
{ level: 'trace', stream: dest }
|
28
|
+
]
|
29
|
+
const pinomsFour = pino({ level: 'debug' }, pino.multistream(fourStreams))
|
30
|
+
|
31
|
+
const pinomsOne = pino({ level: 'info' }, pino.multistream(dest))
|
32
|
+
const blogOne = bunyan.createLogger({
|
33
|
+
name: 'myapp',
|
34
|
+
streams: [{ stream: dest }]
|
35
|
+
})
|
36
|
+
|
37
|
+
const blogTen = bunyan.createLogger({
|
38
|
+
name: 'myapp',
|
39
|
+
streams: tenStreams
|
40
|
+
})
|
41
|
+
const blogFour = bunyan.createLogger({
|
42
|
+
name: 'myapp',
|
43
|
+
streams: fourStreams
|
44
|
+
})
|
45
|
+
|
46
|
+
const max = 10
|
47
|
+
const run = bench([
|
48
|
+
function benchBunyanTen (cb) {
|
49
|
+
for (let i = 0; i < max; i++) {
|
50
|
+
blogTen.info('hello world')
|
51
|
+
blogTen.debug('hello world')
|
52
|
+
blogTen.trace('hello world')
|
53
|
+
blogTen.warn('hello world')
|
54
|
+
blogTen.fatal('hello world')
|
55
|
+
}
|
56
|
+
setImmediate(cb)
|
57
|
+
},
|
58
|
+
function benchPinoMSTen (cb) {
|
59
|
+
for (let i = 0; i < max; i++) {
|
60
|
+
pinomsTen.info('hello world')
|
61
|
+
pinomsTen.debug('hello world')
|
62
|
+
pinomsTen.trace('hello world')
|
63
|
+
pinomsTen.warn('hello world')
|
64
|
+
pinomsTen.fatal('hello world')
|
65
|
+
}
|
66
|
+
setImmediate(cb)
|
67
|
+
},
|
68
|
+
function benchBunyanFour (cb) {
|
69
|
+
for (let i = 0; i < max; i++) {
|
70
|
+
blogFour.info('hello world')
|
71
|
+
blogFour.debug('hello world')
|
72
|
+
blogFour.trace('hello world')
|
73
|
+
}
|
74
|
+
setImmediate(cb)
|
75
|
+
},
|
76
|
+
function benchPinoMSFour (cb) {
|
77
|
+
for (let i = 0; i < max; i++) {
|
78
|
+
pinomsFour.info('hello world')
|
79
|
+
pinomsFour.debug('hello world')
|
80
|
+
pinomsFour.trace('hello world')
|
81
|
+
}
|
82
|
+
setImmediate(cb)
|
83
|
+
},
|
84
|
+
function benchBunyanOne (cb) {
|
85
|
+
for (let i = 0; i < max; i++) {
|
86
|
+
blogOne.info('hello world')
|
87
|
+
}
|
88
|
+
setImmediate(cb)
|
89
|
+
},
|
90
|
+
function benchPinoMSOne (cb) {
|
91
|
+
for (let i = 0; i < max; i++) {
|
92
|
+
pinomsOne.info('hello world')
|
93
|
+
}
|
94
|
+
setImmediate(cb)
|
95
|
+
}
|
96
|
+
], 10000)
|
97
|
+
|
98
|
+
run()
|
@@ -0,0 +1,82 @@
|
|
1
|
+
'use strict'
|
2
|
+
|
3
|
+
const bench = require('fastbench')
|
4
|
+
const pino = require('../')
|
5
|
+
const bunyan = require('bunyan')
|
6
|
+
const bole = require('bole')('bench')
|
7
|
+
const winston = require('winston')
|
8
|
+
const fs = require('node:fs')
|
9
|
+
const dest = fs.createWriteStream('/dev/null')
|
10
|
+
const loglevel = require('./utils/wrap-log-level')(dest)
|
11
|
+
const plogNodeStream = pino(dest)
|
12
|
+
delete require.cache[require.resolve('../')]
|
13
|
+
const plogDest = require('../')(pino.destination('/dev/null'))
|
14
|
+
delete require.cache[require.resolve('../')]
|
15
|
+
const plogMinLength = require('../')(pino.destination({ dest: '/dev/null', sync: false, minLength: 4096 }))
|
16
|
+
const blog = bunyan.createLogger({
|
17
|
+
name: 'myapp',
|
18
|
+
streams: [{
|
19
|
+
level: 'trace',
|
20
|
+
stream: dest
|
21
|
+
}]
|
22
|
+
})
|
23
|
+
require('bole').output({
|
24
|
+
level: 'info',
|
25
|
+
stream: dest
|
26
|
+
}).setFastTime(true)
|
27
|
+
const chill = winston.createLogger({
|
28
|
+
transports: [
|
29
|
+
new winston.transports.Stream({
|
30
|
+
stream: fs.createWriteStream('/dev/null')
|
31
|
+
})
|
32
|
+
]
|
33
|
+
})
|
34
|
+
|
35
|
+
const max = 10
|
36
|
+
|
37
|
+
const run = bench([
|
38
|
+
function benchBunyanObj (cb) {
|
39
|
+
for (var i = 0; i < max; i++) {
|
40
|
+
blog.info({ hello: 'world' })
|
41
|
+
}
|
42
|
+
setImmediate(cb)
|
43
|
+
},
|
44
|
+
function benchWinstonObj (cb) {
|
45
|
+
for (var i = 0; i < max; i++) {
|
46
|
+
chill.info({ hello: 'world' })
|
47
|
+
}
|
48
|
+
setImmediate(cb)
|
49
|
+
},
|
50
|
+
function benchBoleObj (cb) {
|
51
|
+
for (var i = 0; i < max; i++) {
|
52
|
+
bole.info({ hello: 'world' })
|
53
|
+
}
|
54
|
+
setImmediate(cb)
|
55
|
+
},
|
56
|
+
function benchLogLevelObject (cb) {
|
57
|
+
for (var i = 0; i < max; i++) {
|
58
|
+
loglevel.info({ hello: 'world' })
|
59
|
+
}
|
60
|
+
setImmediate(cb)
|
61
|
+
},
|
62
|
+
function benchPinoObj (cb) {
|
63
|
+
for (var i = 0; i < max; i++) {
|
64
|
+
plogDest.info({ hello: 'world' })
|
65
|
+
}
|
66
|
+
setImmediate(cb)
|
67
|
+
},
|
68
|
+
function benchPinoMinLengthObj (cb) {
|
69
|
+
for (var i = 0; i < max; i++) {
|
70
|
+
plogMinLength.info({ hello: 'world' })
|
71
|
+
}
|
72
|
+
setImmediate(cb)
|
73
|
+
},
|
74
|
+
function benchPinoNodeStreamObj (cb) {
|
75
|
+
for (var i = 0; i < max; i++) {
|
76
|
+
plogNodeStream.info({ hello: 'world' })
|
77
|
+
}
|
78
|
+
setImmediate(cb)
|
79
|
+
}
|
80
|
+
], 10000)
|
81
|
+
|
82
|
+
run(run)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
'use strict'
|
2
|
+
const { join } = require('node:path')
|
3
|
+
const { execSync } = require('node:child_process')
|
4
|
+
|
5
|
+
const run = (type) => {
|
6
|
+
process.stderr.write(`benchmarking ${type}\n`)
|
7
|
+
return execSync(`node ${join(__dirname, 'runbench')} ${type} -q`)
|
8
|
+
}
|
9
|
+
|
10
|
+
console.log(`
|
11
|
+
# Benchmarks
|
12
|
+
|
13
|
+
\`pino.info('hello world')\`:
|
14
|
+
|
15
|
+
\`\`\`
|
16
|
+
${run('basic')}
|
17
|
+
\`\`\`
|
18
|
+
|
19
|
+
\`pino.info({'hello': 'world'})\`:
|
20
|
+
|
21
|
+
\`\`\`
|
22
|
+
${run('object')}
|
23
|
+
\`\`\`
|
24
|
+
|
25
|
+
\`pino.info(aBigDeeplyNestedObject)\`:
|
26
|
+
|
27
|
+
\`\`\`
|
28
|
+
${run('deep-object')}
|
29
|
+
\`\`\`
|
30
|
+
|
31
|
+
\`pino.info('hello %s %j %d', 'world', {obj: true}, 4, {another: 'obj'})\`:
|
32
|
+
|
33
|
+
For a fair comparison, [LogLevel](http://npm.im/loglevel) was extended
|
34
|
+
to include a timestamp and [bole](http://npm.im/bole) had
|
35
|
+
\`fastTime\` mode switched on.
|
36
|
+
`)
|