forked from ekino/node-logger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
complex.js
41 lines (37 loc) · 1.17 KB
/
complex.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env node
import {
createBenchmarkSuite,
generateNestedObject,
initializeLoggers,
runSuiteWithDynamicTimeout,
} from './utils.js'
const { ekinoLoggerV2, ekinoLoggerV3, pinoLogger, winstonLogger } = initializeLoggers()
const suite = createBenchmarkSuite('Logger Benchmark - Complex')
const contextId = 'a037df3b-dbee-448e-9abb-8024d867ccc8'
const logObject = generateNestedObject(10, 2)
suite
.addTest('@ekino/logger v2.x', () => {
ekinoLoggerV2.info(
contextId,
'This is a benchmark log message for @ekino/logger v2.x',
logObject
)
})
.addTest('@ekino/logger v3.x', () => {
ekinoLoggerV3.info(
contextId,
'This is a benchmark log message for @ekino/logger v3.x',
logObject
)
})
.addTest('Winston', () => {
winstonLogger.info('This is a benchmark log message for Winston', logObject)
})
.addTest('Pino', () => {
pinoLogger.info({
ctxId: contextId,
...logObject,
message: 'This is a benchmark log message for Pino',
})
})
await runSuiteWithDynamicTimeout(suite, 40000)