You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- Use this checklist to make sure your PR is ready for merge. You may
delete any sections you don't need. -->
## DESCRIBE YOUR PR
Based on feedback from slack after merging in
#13603
## 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/)
Copy file name to clipboardExpand all lines: includes/logs/javascript-usage.mdx
+15-11Lines changed: 15 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,30 +2,34 @@ Once the feature is enabled on the SDK and the SDK is initialized, you can send
2
2
3
3
The `Sentry.logger` namespace exposes six methods that you can use to log messages at different log levels: `trace`, `debug`, `info`, `warn`, `error`, and `fatal`.
4
4
5
-
Aside from the primary logging methods, we've provided a format text function, `fmt`, that you can use to add insert properties into to your log entries.
5
+
Aside from the primary logging methods, we've provided a format text function, `Sentry.logger.fmt`, that you can use to add insert properties into to your log entries.
6
+
6
7
These properties will be sent to Sentry, and can be searched from within the Logs UI, and even added to the Logs views as a dedicated column.
7
8
8
9
```js
9
-
const { info, warn, fmt} =Sentry.logger;
10
+
const { logger} = Sentry;
10
11
11
-
error(fmt`Uh on, something broke, here's the error: '${error}'`);
12
-
info(fmt`User '${user.username}' added item '${product.name}' to cart.`);
12
+
logger.error(logger.fmt`Uh on, something broke, here's the error: '${error}'`);
13
+
logger.info(logger.fmt`'${user.username}' added '${product.name}' to cart.`);
13
14
```
14
15
15
16
You can also pass additional attributes directly to the logging functions, avoiding the need to use the `fmt` function.
0 commit comments