Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
pino-abstract-transport
Advanced tools
The pino-abstract-transport package provides a way to create custom transports for Pino, a fast JSON logger for Node.js. These transports can be used to process or forward log messages to different destinations or services in a structured and efficient manner. The package simplifies the development of these transports by abstracting common tasks and providing a standard interface for implementation.
Creating a custom transport
This feature allows developers to create a custom transport for Pino logs. The code sample demonstrates how to use the `build` function from `pino-abstract-transport` to create a simple transport that prints log messages to the console.
"use strict";\nconst { build } = require('pino-abstract-transport');\nasync function myTransport(opts) {\n return async function (source) {\n for await (const obj of source) {\n console.log(obj);\n }\n };\n}\nmodule.exports = build(myTransport);"
Pino-pretty is a module that can be used to format Pino log messages in a more human-readable way. Unlike pino-abstract-transport, which is focused on creating custom transports, pino-pretty is specifically designed for pretty-printing log messages in development environments.
Pino-elasticsearch is a transport for Pino that forwards log messages to Elasticsearch. It provides a more specialized functionality compared to pino-abstract-transport, which offers a generic interface for building various types of transports.
Write Pino transports easily.
npm i pino-abstract-transport
import build from 'pino-abstract-stream'
exports default async function (opts) {
return build(async function (source) {
for await (let obj of source) {
console.log(obj)
}
})
}
or in CommonJS and streams:
'use strict'
const build = require('pino-abstract-stream')
module.exports = function (opts) {
return build(function (source) {
source.on('data', function (obj) {
console.log(obj)
})
})
}
Create a split2
instance and returns it.
This same instance is also passed to the given function, which is called
synchronously.
In addition to all events emitted by a Readable
stream, it emits the following events:
unknown
where an unparsaeble line is found, both the line and optional error is emitted.MIT
FAQs
Write Pino transports easily
The npm package pino-abstract-transport receives a total of 6,851,967 weekly downloads. As such, pino-abstract-transport popularity was classified as popular.
We found that pino-abstract-transport demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.