Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
25 lines
704 B
Plaintext
25 lines
704 B
Plaintext
'use strict'
|
|
|
|
const { Transform, pipeline } = require('stream')
|
|
const build = require('../..')
|
|
|
|
module.exports = function (threadStreamOpts) {
|
|
const { opts = {} } = threadStreamOpts
|
|
return build(function (source) {
|
|
const transform = new Transform({
|
|
objectMode: true,
|
|
autoDestroy: true,
|
|
transform (chunk, enc, cb) {
|
|
chunk.service = 'from transform'
|
|
chunk.level = `${source.levels.labels[chunk.level]}(${chunk.level})`
|
|
chunk[source.messageKey] = chunk[source.messageKey].toUpperCase()
|
|
cb(null, JSON.stringify(chunk) + '\n')
|
|
}
|
|
})
|
|
|
|
pipeline(source, transform, () => {})
|
|
|
|
return transform
|
|
}, { ...opts, enablePipelining: true })
|
|
}
|