sync mode on
This commit is contained in:
1 parent
1818932244
commit
1174b328e5
415 files changed
+44294
-1182
No files matched your search
+33
@@ -0,0 +1,33 @@
|
||||
'use strict'
|
||||
|
||||
const build = require('pino-abstract-transport')
|
||||
const { pipeline, Transform } = require('node:stream')
|
||||
module.exports = () => {
|
||||
return build(function (source) {
|
||||
const myTransportStream = new Transform({
|
||||
autoDestroy: true,
|
||||
objectMode: true,
|
||||
transform (chunk, enc, cb) {
|
||||
const {
|
||||
time,
|
||||
level,
|
||||
[source.messageKey]: body,
|
||||
[source.errorKey]: error,
|
||||
...attributes
|
||||
} = chunk
|
||||
this.push(JSON.stringify({
|
||||
severityText: source.levels.labels[level],
|
||||
body,
|
||||
attributes,
|
||||
...(error && { error })
|
||||
}))
|
||||
cb()
|
||||
}
|
||||
})
|
||||
pipeline(source, myTransportStream, () => {})
|
||||
return myTransportStream
|
||||
}, {
|
||||
enablePipelining: true,
|
||||
expectPinoConfig: true
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user