Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions docs/platforms/javascript/common/configuration/integrations/pino.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
title: Pino
description: "Capture logs and errors from Pino."
supported:
- javascript.node
- javascript.astro
- javascript.aws-lambda
- javascript.azure-functions
- javascript.connect
- javascript.deno
- javascript.express
- javascript.fastify
- javascript.gcp-functions
- javascript.hapi
- javascript.hono
- javascript.koa
- javascript.electron
- javascript.nestjs
- javascript.nextjs
- javascript.nuxt
- javascript.solidstart
- javascript.sveltekit
- javascript.remix
- javascript.react-router
- javascript.astro
- javascript.bun
- javascript.tanstackstart-react
---

<Alert>

This integration only works in the Node.js and Bun runtimes. Requires SDK version `10.18.0` or higher.

</Alert>

_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.

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

## Options

### `error`

Configure how pino logs are captured as Sentry errors.

#### `levels`

- 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.

#### `handled`

- 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.

### `log`

Configure how pino logs are captured as Sentry logs.

#### `levels`

- 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.

## Supported Versions

- `pino`: `>=8.0.0 <10`

## Examples

### Send only info, error, and warn log levels to Sentry

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

### Send errors to Sentry

```js
Sentry.init({
integrations: [
Sentry.pinoIntegration({ error: { levels: ["warn", "error"] } }),
],
});
```
11 changes: 11 additions & 0 deletions includes/logs/javascript-pino-integration.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Winston Integration

In `10.18.0` and above of the JavaScript SDKs, we've added support to send logs via the pino logging library. To add the pino integration, you need to add the `pinoIntegration` to your Sentry initialization.

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

You can look at the <PlatformLink to="/configuration/integrations/pino">Pino integration documentation</PlatformLink> for more information on the options you can pass to the `pinoIntegration`.
1 change: 0 additions & 1 deletion includes/logs/javascript-upcoming-integrations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

We're actively working on adding more integration support for Logs. You can follow progress on the following GitHub issues or open a [new one](https://github.com/getsentry/sentry-javascript/issues/new/choose) for any integration you would like to see.

- [Pino](https://github.com/getsentry/sentry-javascript/issues/15952)
- [Node Bunyan](https://github.com/getsentry/sentry-javascript/issues/16474)
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@ Depending on whether an integration enhances the functionality of a particular r
| [`anthropicAIIntegration`](./anthropic) | ✓ | ✓ | ✓ | |
| [`googleGenAIIntegration`](./google-genai) | ✓ | ✓ | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
| [`pinoIntegration`](./pino) | | ✓ | | |
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@
| [`tediousIntegration`](./tedious) | | | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
| [`pinoIntegration`](./pino) | | ✓ | | |
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
| [`pinoIntegration`](./pino) | | ✓ | | |
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@
| [`prismaIntegration`](./prisma) | | | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
| [`pinoIntegration`](./pino) | | ✓ | | |
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
| [`pinoIntegration`](./pino) | | ✓ | | |
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@
| [`tediousIntegration`](./tedious) | | | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
| [`pinoIntegration`](./pino) | | ✓ | | |
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@
| [`supabaseIntegration`](./supabase) | | ✓ | ✓ | |
| [`trpcMiddleware`](./trpc) | | ✓ | ✓ | ✓ |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
| [`pinoIntegration`](./pino) | | ✓ | | |
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@
| [`anthropicAIIntegration`](./anthropic) | ✓ | ✓ | ✓ | |
| [`googleGenAIIntegration`](./google-genai) | ✓ | ✓ | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
| [`pinoIntegration`](./pino) | | ✓ | | |
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Depending on whether an integration enhances the functionality of a particular r
| [`anthropicAIIntegration`](./anthropic) | ✓ | ✓ | ✓ | |
| [`googleGenAIIntegration`](./google-genai) | ✓ | ✓ | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
| [`pinoIntegration`](./pino) | | ✓ | | |

### Edge Integrations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@
| [`anthropicAIIntegration`](./anthropic) | ✓ | ✓ | ✓ | |
| [`googleGenAIIntegration`](./google-genai) | ✓ | ✓ | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
| [`pinoIntegration`](./pino) | | ✓ | | |
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ Depending on whether an integration enhances the functionality of a particular r
| [`anthropicAIIntegration`](./anthropic) | ✓ | ✓ | ✓ | |
| [`googleGenAIIntegration`](./google-genai) | ✓ | ✓ | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
| [`pinoIntegration`](./pino) | | ✓ | | |
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ Depending on whether an integration enhances the functionality of a particular r
| [`anthropicAIIntegration`](./anthropic) | ✓ | ✓ | ✓ | |
| [`googleGenAIIntegration`](./google-genai) | ✓ | ✓ | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
| [`pinoIntegration`](./pino) | | ✓ | | |
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ Depending on whether an integration enhances the functionality of a particular r
| [`anthropicAIIntegration`](./anthropic) | ✓ | ✓ | ✓ | |
| [`googleGenAIIntegration`](./google-genai) | ✓ | ✓ | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
| [`pinoIntegration`](./pino) | | ✓ | | |
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ Depending on whether an integration enhances the functionality of a particular r
| [`anthropicAIIntegration`](./anthropic) | ✓ | ✓ | ✓ | |
| [`googleGenAIIntegration`](./google-genai) | ✓ | ✓ | ✓ | |
| [`zodErrorsIntegration`](./zodErrors) | | | | ✓ |
| [`pinoIntegration`](./pino) | | ✓ | | |
2 changes: 2 additions & 0 deletions platform-includes/logs/integrations/javascript.astro.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Include name="logs/javascript-console-logging-integration.mdx" />

<Include name="logs/javascript-pino-integration.mdx" />

<Include name="logs/javascript-consola-integration.mdx" />

<Include name="logs/javascript-winston-integration.mdx" />
Expand Down
2 changes: 2 additions & 0 deletions platform-includes/logs/integrations/javascript.nextjs.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Include name="logs/javascript-console-logging-integration.mdx" />

<Include name="logs/javascript-pino-integration.mdx" />

<Include name="logs/javascript-consola-integration.mdx" />

<Include name="logs/javascript-winston-integration.mdx" />
Expand Down
2 changes: 2 additions & 0 deletions platform-includes/logs/integrations/javascript.node.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Include name="logs/javascript-console-logging-integration.mdx" />

<Include name="logs/javascript-pino-integration.mdx" />

<Include name="logs/javascript-consola-integration.mdx" />

<Include name="logs/javascript-winston-integration.mdx" />
Expand Down
2 changes: 2 additions & 0 deletions platform-includes/logs/integrations/javascript.nuxt.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Include name="logs/javascript-console-logging-integration.mdx" />

<Include name="logs/javascript-pino-integration.mdx" />

<Include name="logs/javascript-consola-integration.mdx" />

<Include name="logs/javascript-winston-integration.mdx" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Include name="logs/javascript-console-logging-integration.mdx" />

<Include name="logs/javascript-pino-integration.mdx" />

<Include name="logs/javascript-consola-integration.mdx" />

<Include name="logs/javascript-winston-integration.mdx" />
Expand Down
2 changes: 2 additions & 0 deletions platform-includes/logs/integrations/javascript.remix.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Include name="logs/javascript-console-logging-integration.mdx" />

<Include name="logs/javascript-pino-integration.mdx" />

<Include name="logs/javascript-consola-integration.mdx" />

<Include name="logs/javascript-winston-integration.mdx" />
Expand Down
2 changes: 2 additions & 0 deletions platform-includes/logs/integrations/javascript.solidstart.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Include name="logs/javascript-console-logging-integration.mdx" />

<Include name="logs/javascript-pino-integration.mdx" />

<Include name="logs/javascript-consola-integration.mdx" />

<Include name="logs/javascript-winston-integration.mdx" />
Expand Down
2 changes: 2 additions & 0 deletions platform-includes/logs/integrations/javascript.sveltekit.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Include name="logs/javascript-console-logging-integration.mdx" />

<Include name="logs/javascript-pino-integration.mdx" />

<Include name="logs/javascript-consola-integration.mdx" />

<Include name="logs/javascript-winston-integration.mdx" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Include name="logs/javascript-console-logging-integration.mdx" />

<Include name="logs/javascript-pino-integration.mdx" />

<Include name="logs/javascript-consola-integration.mdx" />

<Include name="logs/javascript-winston-integration.mdx" />
Expand Down
Loading