add hw2
This commit is contained in:
22
node_modules/pino-abstract-transport/test/fixtures/transport-async-iteration.js
generated
vendored
Normal file
22
node_modules/pino-abstract-transport/test/fixtures/transport-async-iteration.js
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
|
||||
const build = require('../..')
|
||||
|
||||
module.exports = async function (threadStreamOpts) {
|
||||
const { port, opts = {} } = threadStreamOpts
|
||||
return build(
|
||||
async function (source) {
|
||||
for await (const obj of source) {
|
||||
port.postMessage({
|
||||
data: obj,
|
||||
pinoConfig: {
|
||||
levels: source.levels,
|
||||
messageKey: source.messageKey,
|
||||
errorKey: source.errorKey
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
opts
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user