Pino

Capture logs and errors from Pino.

Import name: Sentry.pinoIntegration

The pinoIntegration adds instrumentation for the pino library so that calls to the pino logger as captured as logs. Optionally, you can capture calls to the pino logger as errors.

Copied
Sentry.init({  integrations: [Sentry.pinoIntegration()], }); 

Configure how pino logs are captured as Sentry errors.

  • Type: Array<'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'>
  • Default: []

Levels that trigger capturing of events. When a pino log message is logged at one of these levels, it will be captured as a Sentry error event.

  • Type: boolean
  • Default: true

By default, Sentry will mark captured errors as handled. Set this to false if you want to mark them as unhandled instead.

Configure how pino logs are captured as Sentry logs.

  • Type: Array<'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'>
  • Default: ["trace", "debug", "info", "warn", "error", "fatal"]

Levels that trigger capturing of logs. Logs are only captured if enableLogs is enabled in your Sentry configuration.

  • pino: >=8.0.0 <10

Copied
Sentry.init({  integrations: [  Sentry.pinoIntegration({ log: { levels: ["info", "warn", "error"] } }),  ], }); 

Copied
Sentry.init({  integrations: [  Sentry.pinoIntegration({ error: { levels: ["warn", "error"] } }),  ], }); 
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").