Skip to content

Commit e60f85f

Browse files
authored
feat: Document consola logs integration for js (#14960)
<!-- 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 getsentry/sentry-javascript#17435 ## 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 d75aee2 commit e60f85f

14 files changed

+47
-2
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
### Consola Integration
2+
3+
In `10.12.0` and above of the JavaScript SDKs, we've added support to send logs via the [consola](https://github.com/unjs/consola) logging library.
4+
5+
```js
6+
import { consola } from "consola";
7+
8+
// Create a Sentry reporter for consola
9+
const sentryReporter = Sentry.createConsolaReporter();
10+
11+
// Add the reporter to consola
12+
consola.addReporter(sentryReporter);
13+
```
14+
15+
The `createConsolaReporter` method accepts a `levels` option, which allows you to filter which levels are sent to Sentry. By default all levels are logged.
16+
17+
```js
18+
const sentryReporter = Sentry.createConsolaReporter({
19+
levels: ["error", "warn"],
20+
});
21+
```

includes/logs/javascript-upcoming-integrations.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
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-
- [Consola](https://github.com/getsentry/sentry-javascript/issues/16659)
6-
- [Pino](https://github.com/getsentry/sentry-javascript/issues/15952)
5+
- [Pino](https://github.com/getsentry/sentry-javascript/issues/15952)
6+
- [Node Bunyan](https://github.com/getsentry/sentry-javascript/issues/16474)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<Include name="logs/javascript-console-logging-integration.mdx" />
22

3+
<Include name="logs/javascript-consola-integration.mdx" />
4+
35
<Include name="logs/javascript-winston-integration.mdx" />
46

57
<Include name="logs/javascript-upcoming-integrations.mdx" />
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
<Include name="logs/javascript-console-logging-integration.mdx" />
2+
3+
<Include name="logs/javascript-consola-integration.mdx" />
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
<Include name="logs/javascript-console-logging-integration.mdx" />
2+
3+
<Include name="logs/javascript-consola-integration.mdx" />
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<Include name="logs/javascript-console-logging-integration.mdx" />
22

3+
<Include name="logs/javascript-consola-integration.mdx" />
4+
35
<Include name="logs/javascript-winston-integration.mdx" />
46

57
<Include name="logs/javascript-upcoming-integrations.mdx" />
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<Include name="logs/javascript-console-logging-integration.mdx" />
22

3+
<Include name="logs/javascript-consola-integration.mdx" />
4+
35
<Include name="logs/javascript-winston-integration.mdx" />
46

57
<Include name="logs/javascript-upcoming-integrations.mdx" />
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<Include name="logs/javascript-console-logging-integration.mdx" />
22

3+
<Include name="logs/javascript-consola-integration.mdx" />
4+
35
<Include name="logs/javascript-winston-integration.mdx" />
46

57
<Include name="logs/javascript-upcoming-integrations.mdx" />
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<Include name="logs/javascript-console-logging-integration.mdx" />
22

3+
<Include name="logs/javascript-consola-integration.mdx" />
4+
35
<Include name="logs/javascript-winston-integration.mdx" />
46

57
<Include name="logs/javascript-upcoming-integrations.mdx" />
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<Include name="logs/javascript-console-logging-integration.mdx" />
22

3+
<Include name="logs/javascript-consola-integration.mdx" />
4+
35
<Include name="logs/javascript-winston-integration.mdx" />
46

57
<Include name="logs/javascript-upcoming-integrations.mdx" />

0 commit comments

Comments
 (0)