@blacklab/pino-sentry-transport

1.2.4 • Public • Published

Pino Sentry transport

NPM CircleCI

This module provides a 'transport' for pino that sends errors to Sentry.

Install

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>",
        // aditional options for sentry
      },
      withLogRecord: true, // default false - send the log record to sentry as a context.(if its more then 8Kb Sentry will throw an error)
      tags: ['id'], // 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
    }
  },
});

if log contain error, it will send to sentry using captureException if not it will use captureMessage.

Readme

Keywords

Package Sidebar

Install

npm i @blacklab/pino-sentry-transport

Weekly Downloads

1

Version

1.2.4

License

MIT

Unpacked Size

56.9 kB

Total Files

17

Last publish

Collaborators

  • gooftroop