Gathering detailed insights and metrics for pino-abstract-transport
Gathering detailed insights and metrics for pino-abstract-transport
Gathering detailed insights and metrics for pino-abstract-transport
Gathering detailed insights and metrics for pino-abstract-transport
bingo-abstract-transport
Write Pino transports easily
cloud-pine
Pino Transport abstraction for Google Cloud Logging.
@patrtorg/molestias-perspiciatis-velit
[![github actions][actions-image]][actions-url] [![coverage][codecov-image]][codecov-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url]
@zitterorg/magni-eos
[![github actions][actions-image]][actions-url] [![coverage][codecov-image]][codecov-url] [![dependency status][deps-svg]][deps-url] [![dev dependency status][dev-deps-svg]][dev-deps-url] [![License][license-image]][license-url] [![Downloads][downloads-im
npm install pino-abstract-transport
Typescript
Module System
Node Version
NPM Version
99.7
Supply Chain
100
Quality
76.7
Maintenance
100
Vulnerability
100
License
JavaScript (95.25%)
TypeScript (4.48%)
Shell (0.27%)
Total Downloads
746,315,784
Last Day
484,512
Last Week
9,839,524
Last Month
42,149,536
Last Year
407,356,939
MIT License
36 Stars
100 Commits
13 Forks
5 Watchers
6 Branches
18 Contributors
Updated on Jun 21, 2025
Minified
Minified + Gzipped
Latest Version
2.0.0
Package Id
pino-abstract-transport@2.0.0
Unpacked Size
37.31 kB
Size
8.26 kB
File Count
15
NPM Version
10.8.1
Node Version
20.16.0
Published on
Sep 03, 2024
Cumulative downloads
Total Downloads
Last Day
1.1%
484,512
Compared to previous day
Last Week
-7.2%
9,839,524
Compared to previous week
Last Month
2.6%
42,149,536
Compared to previous month
Last Year
83%
407,356,939
Compared to previous year
1
7
Write Pino transports easily.
1npm i pino-abstract-transport
1import build from 'pino-abstract-transport' 2 3export default async function (opts) { 4 return build(async function (source) { 5 for await (let obj of source) { 6 console.log(obj) 7 } 8 }) 9}
or in CommonJS and streams:
1'use strict' 2 3const build = require('pino-abstract-transport') 4 5module.exports = function (opts) { 6 return build(function (source) { 7 source.on('data', function (obj) { 8 console.log(obj) 9 }) 10 }) 11}
Install the type definitions for node. Make sure the major version of the type definitions matches the node version you are using.
1npm i -D @types/node@16
Create a split2
instance and returns it.
This same instance is also passed to the given function, which is called
synchronously.
If opts.transform
is true
, pino-abstract-transform
will
wrap the split2 instance and the returned stream using duplexify
,
so they can be concatenated into multiple transports.
In addition to all events emitted by a Readable
stream, it emits the following events:
unknown
where an unparsable line is found, both the line and optional error is emitted.parse
an option to change to data format passed to build function. When this option is set to lines
,
the data is passed as a string, otherwise the data is passed as an object. Default: undefined
.
close(err, cb)
a function that is called to shutdown the transport. It's called both on error and non-error shutdowns.
It can also return a promise. In this case discard the the cb
argument.
parseLine(line)
a function that is used to parse line received from pino
.
expectPinoConfig
a boolean that indicates if the transport expects Pino to add some of its configuration to the stream. Default: false
.
You can allow custom parseLine
from users while providing a simple and safe default parseLine.
1'use strict' 2 3const build = require('pino-abstract-transport') 4 5function defaultParseLine (line) { 6 const obj = JSON.parse(line) 7 // property foo will be added on each line 8 obj.foo = 'bar' 9 return obj 10} 11 12module.exports = function (opts) { 13 const parseLine = typeof opts.parseLine === 'function' ? opts.parseLine : defaultParseLine 14 return build(function (source) { 15 source.on('data', function (obj) { 16 console.log(obj) 17 }) 18 }, { 19 parseLine: parseLine 20 }) 21}
You can pipeline multiple transports:
1const build = require('pino-abstract-transport') 2const { Transform, pipeline } = require('stream') 3 4function buildTransform () { 5 return build(function (source) { 6 return new Transform({ 7 objectMode: true, 8 autoDestroy: true, 9 transform (line, enc, cb) { 10 line.service = 'bob' 11 cb(null, JSON.stringify(line)) 12 } 13 }) 14 }, { enablePipelining: true }) 15} 16 17function buildDestination () { 18 return build(function (source) { 19 source.on('data', function (obj) { 20 console.log(obj) 21 }) 22 }) 23} 24 25pipeline(process.stdin, buildTransform(), buildDestination(), function (err) { 26 console.log('pipeline completed!', err) 27})
Setting expectPinoConfig
to true
will make the transport wait for pino to send its configuration before starting to process logs. It will add levels
, messageKey
and errorKey
to the stream.
When used with an incompatible version of pino, the stream will immediately error.
1import build from 'pino-abstract-transport' 2 3export default function (opts) { 4 return build(async function (source) { 5 for await (const obj of source) { 6 console.log(`[${source.levels.labels[obj.level]}]: ${obj[source.messageKey]}`) 7 } 8 }, { 9 expectPinoConfig: true 10 }) 11}
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 10/14 approved changesets -- score normalized to 7
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More