Skip to content

ref(javascript): Replace deprecated severity enums with string literals #4940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 30, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Sentry.addBreadcrumb({
category: "auth",
message: "Authenticated user " + user.email,
level: Sentry.Severity.Info,
level: "info",
});
```
6 changes: 4 additions & 2 deletions src/includes/set-level/javascript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ To set the level out of scope, you can call `captureMessage()` per event:
Sentry.captureMessage("this is a debug message", "debug");
```

Available levels are `"fatal"`, `"critical"`, `"error"`, `"warning"`, `"log"`, `"info"`, and `"debug"`.

To set the level within scope, you can call `setLevel()`:

```javascript
Sentry.configureScope(function(scope) {
scope.setLevel(Sentry.Severity.Warning);
scope.setLevel("warning");
});
```

Expand All @@ -20,8 +22,8 @@ Sentry.withScope(function(scope) {

// The exception has the event level set by the scope (info).
Sentry.captureException(new Error("custom error"));

});

// Outside of withScope, the Event level will have their previous value restored.
// The exception has the event level set (error).
Sentry.captureException(new Error("custom error 2"));
Expand Down
6 changes: 6 additions & 0 deletions src/platforms/common/enriching-events/breadcrumbs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ The available breadcrumb keys are `type`, `category`, `message`, `level`, `times

</PlatformSection>

<PlatformSection supported={["javascript", "node"]}>

You can choose from the following breadcrumb log levels: `"fatal"`, `"critical"`, `"error"`, `"warning"`, `"log"`, `"info"`, and `"debug"`.

</PlatformSection>

<PlatformSection notSupported={["native", "unreal"]}>

## Automatic Breadcrumbs
Expand Down
4 changes: 2 additions & 2 deletions src/platforms/javascript/common/troubleshooting/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,12 @@ document.body.addEventListener(
if (event.target.tagName === "IMG") {
Sentry.captureMessage(
`Failed to load image: ${event.target.src}`,
Sentry.Severity.Warning
"warning"
);
} else if (event.target.tagName === "LINK") {
Sentry.captureMessage(
`Failed to load css: ${event.target.href}`,
Sentry.Severity.Warning
"warning"
);
}
},
Expand Down