1.1.0 • Published 2 months ago

pino-sentry-transport v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Pino Sentry transport

NPM npm version GitHub Workflow Status

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

Install

npm i @sentry/node 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 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.

Sentry initialization

Because Pino transport runs in a separate worker thread, Sentry needs to be initialized again in the worker. usually it means Sentry need to be initialized twice

  1. in the application code
  2. in pino-sentry-transport

skipSentryInitialization is removed from the documentation

1.1.0

2 months ago

1.0.5

9 months ago

1.0.4

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.3

1 year ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago