Projektstart
This commit is contained in:
33
backend/node_modules/pino/test/fixtures/transport-uses-pino-config.js
generated
vendored
Normal file
33
backend/node_modules/pino/test/fixtures/transport-uses-pino-config.js
generated
vendored
Normal file
@@ -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