Skip to content

Commit 3fbc47b

Browse files
authored
feat: Document pino integration (#15166)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ## DESCRIBE YOUR PR Documents change in getsentry/sentry-javascript#17584 ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## LEGAL BOILERPLATE <!-- Sentry employees and contractors can delete or ignore this section. --> Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms. ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
1 parent 747fef6 commit 3fbc47b

26 files changed

+144
-1
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: Pino
3+
description: "Capture logs and errors from Pino."
4+
supported:
5+
- javascript.node
6+
- javascript.astro
7+
- javascript.aws-lambda
8+
- javascript.azure-functions
9+
- javascript.connect
10+
- javascript.deno
11+
- javascript.express
12+
- javascript.fastify
13+
- javascript.gcp-functions
14+
- javascript.hapi
15+
- javascript.hono
16+
- javascript.koa
17+
- javascript.electron
18+
- javascript.nestjs
19+
- javascript.nextjs
20+
- javascript.nuxt
21+
- javascript.solidstart
22+
- javascript.sveltekit
23+
- javascript.remix
24+
- javascript.react-router
25+
- javascript.astro
26+
- javascript.bun
27+
- javascript.tanstackstart-react
28+
---
29+
30+
<Alert>
31+
32+
This integration only works in the Node.js and Bun runtimes. Requires SDK version `10.18.0` or higher.
33+
34+
</Alert>
35+
36+
_Import name: `Sentry.pinoIntegration`_
37+
38+
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.
39+
40+
```JavaScript
41+
Sentry.init({
42+
integrations: [Sentry.pinoIntegration()],
43+
});
44+
```
45+
46+
## Options
47+
48+
### `error`
49+
50+
Configure how pino logs are captured as Sentry errors.
51+
52+
#### `levels`
53+
54+
- Type: `Array<'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'>`
55+
- Default: `[]`
56+
57+
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.
58+
59+
#### `handled`
60+
61+
- Type: `boolean`
62+
- Default: `true`
63+
64+
By default, Sentry will mark captured errors as handled. Set this to `false` if you want to mark them as unhandled instead.
65+
66+
### `log`
67+
68+
Configure how pino logs are captured as Sentry logs.
69+
70+
#### `levels`
71+
72+
- Type: `Array<'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'>`
73+
- Default: `["trace", "debug", "info", "warn", "error", "fatal"]`
74+
75+
Levels that trigger capturing of logs. Logs are only captured if `enableLogs` is enabled in your Sentry configuration.
76+
77+
## Supported Versions
78+
79+
- `pino`: `>=8.0.0 <10`
80+
81+
## Examples
82+
83+
### Send only info, error, and warn log levels to Sentry
84+
85+
```js
86+
Sentry.init({
87+
integrations: [
88+
Sentry.pinoIntegration({ log: { levels: ["info", "warn", "error"] } }),
89+
],
90+
});
91+
```
92+
93+
### Send errors to Sentry
94+
95+
```js
96+
Sentry.init({
97+
integrations: [
98+
Sentry.pinoIntegration({ error: { levels: ["warn", "error"] } }),
99+
],
100+
});
101+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### Pino Integration
2+
3+
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.
4+
5+
```js
6+
Sentry.init({
7+
integrations: [Sentry.pinoIntegration()],
8+
});
9+
```
10+
11+
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`.

includes/logs/javascript-upcoming-integrations.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22

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

5-
- [Pino](https://github.com/getsentry/sentry-javascript/issues/15952)
65
- [Node Bunyan](https://github.com/getsentry/sentry-javascript/issues/16474)

platform-includes/configuration/integrations/javascript.astro.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,4 @@ Depending on whether an integration enhances the functionality of a particular r
8585
| [`anthropicAIIntegration`](./anthropic) |||| |
8686
| [`googleGenAIIntegration`](./google-genai) |||| |
8787
| [`zodErrorsIntegration`](./zodErrors) | | | ||
88+
| [`pinoIntegration`](./pino) | || | |

platform-includes/configuration/integrations/javascript.aws-lambda.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@
4747
| [`tediousIntegration`](./tedious) | | || |
4848
| [`trpcMiddleware`](./trpc) | ||||
4949
| [`zodErrorsIntegration`](./zodErrors) | | | ||
50+
| [`pinoIntegration`](./pino) | || | |

platform-includes/configuration/integrations/javascript.bun.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@
4141
| [`supabaseIntegration`](./supabase) | ||| |
4242
| [`trpcMiddleware`](./trpc) | ||||
4343
| [`zodErrorsIntegration`](./zodErrors) | | | ||
44+
| [`pinoIntegration`](./pino) | || | |

platform-includes/configuration/integrations/javascript.connect.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@
4646
| [`prismaIntegration`](./prisma) | | || |
4747
| [`trpcMiddleware`](./trpc) | ||||
4848
| [`zodErrorsIntegration`](./zodErrors) | | | ||
49+
| [`pinoIntegration`](./pino) | || | |

platform-includes/configuration/integrations/javascript.fastify.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@
4747
| [`supabaseIntegration`](./supabase) | ||| |
4848
| [`trpcMiddleware`](./trpc) | ||||
4949
| [`zodErrorsIntegration`](./zodErrors) | | | ||
50+
| [`pinoIntegration`](./pino) | || | |

platform-includes/configuration/integrations/javascript.gcp-functions.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@
4747
| [`tediousIntegration`](./tedious) | | || |
4848
| [`trpcMiddleware`](./trpc) | ||||
4949
| [`zodErrorsIntegration`](./zodErrors) | | | ||
50+
| [`pinoIntegration`](./pino) | || | |

platform-includes/configuration/integrations/javascript.hapi.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@
4747
| [`supabaseIntegration`](./supabase) | ||| |
4848
| [`trpcMiddleware`](./trpc) | ||||
4949
| [`zodErrorsIntegration`](./zodErrors) | | | ||
50+
| [`pinoIntegration`](./pino) | || | |

0 commit comments

Comments
 (0)