Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@mia-platform/kafkajs-pino-logger

Package Overview
Dependencies
Maintainers
5
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mia-platform/kafkajs-pino-logger

A custom Pino logger for KafkaJS that follows the Mia-Platform guidelines'

latest
Source
npmnpm
Version
2.0.1
Version published
Weekly downloads
184
17.95%
Maintainers
5
Weekly downloads
 
Created
Source

KafkaJS pino logger

NPM version javascript style guide Coverage Status

This library provides a pino custom logger for KafkaJS that follows Mia-Platform guidelines for logs

Getting Started

Install

The package requires kafkajs to work, to list the correct version you can run:

npm info "@mia-platform/kafkajs-pino-logger@latest" peerDependencies

To install the package you can run:

npm install @mia-platform/kafkajs-pino-logger --save

How to use it

The package exposes a log creator that you can pass to the logCreator option when configuring your Kafka client.

const { Kafka } = require('kafkajs')
const PinoLogCreator = require('@mia-platform/kafkajs-pino-logger')

const kafka = new Kafka({
  clientId: 'my-app',
  brokers: ['kafka1:9092', 'kafka2:9092'],
  logLevel: logLevel.ERROR,
  logCreator: PinoLogCreator
})

Output logs

The logs will have this form:

{"level":20,"time":1610718695,"pid":46244,"hostname":"test-host","logger":"kafkajs","extraKey":"Your extra","msg":"Your log message"}

FAQs

Package last updated on 02 Oct 2023

Did you know?

Socket

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.

Install

Related posts