New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pino-sentry-transport

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino-sentry-transport

Integrates Pino and Sentry.

  • 1.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14K
increased by22.67%
Maintainers
0
Weekly downloads
 
Created
Source

Pino Sentry transport

npm version npm downloads bundle JSDocs License

Pino Sentry Transport allows you to send logs from Pino directly to Sentry.

Installation

npm i pino-sentry-transport

Usage

import pino from "pino";

const logger = pino({
    transport: {
        target: "pino-sentry-transport",
        options: {
            sentry: {
                dsn: "https://<key>:<secret>@sentry.io/<project>",
                // additional options for sentry
            },
            withLogRecord: true, // default false - send the entire log record to sentry as a context.(FYI if its more then 8Kb Sentry will throw an error)
            tags: ['level'], // sentry tags to add to the event, uses lodash.get to get the value from the log record
            context: ['hostname'], // sentry context to add to the event, uses lodash.get to get the value from the log record,
            minLevel: 40, // which level to send to sentry
            expectPinoConfig: true, // default false - pass true if pino configured with custom messageKey or errorKey see below
        }
    },
});

Configuration Options

  • withLogRecord: When set to true, sends the entire log record as context to Sentry. Be cautious of log records larger than 8KB, as Sentry will throw an error.
  • tags: An array specifying which fields from the log record should be added as tags in Sentry. Uses lodash.get to extract values.
  • context: An array specifying which fields from the log record should be added as context in Sentry. Also uses lodash.get for value extraction.
  • minLevel: The minimum log level required for a message to be sent to Sentry. Log levels follow Pino's conventions (e.g., 40 for 'error').
  • expectPinoConfig: If set to true, allows the transport to work with custom messageKey or errorKey settings in Pino.

Sentry initialization

Because Pino transport runs in a separate worker thread, Sentry needs to be initialized in the transport.

License

This project is licensed under the MIT License - see the LICENSE file for details.

FAQs

Package last updated on 25 Feb 2025

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc