forked from getsentry/sentry-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.py
More file actions
35 lines (30 loc) · 1.05 KB
/
basic.py
File metadata and controls
35 lines (30 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import sentry_sdk
from sentry_sdk.integrations.excepthook import ExcepthookIntegration
from sentry_sdk.integrations.atexit import AtexitIntegration
from sentry_sdk.integrations.dedupe import DedupeIntegration
from sentry_sdk.integrations.stdlib import StdlibIntegration
sentry_sdk.init(
dsn="https://<key>@sentry.io/<project>",
default_integrations=False,
integrations=[
ExcepthookIntegration(),
AtexitIntegration(),
DedupeIntegration(),
StdlibIntegration(),
],
environment="Production",
release="1.0.0",
send_default_pii=False,
max_breadcrumbs=5,
)
with sentry_sdk.push_scope() as scope:
scope.user = {"email": "john.doe@example.com"}
scope.set_tag("page_locale", "de-at")
scope.set_extra("request", {"id": "d5cf8a0fd85c494b9c6453c4fba8ab17"})
scope.level = "warning"
sentry_sdk.capture_message("Something went wrong!")
sentry_sdk.add_breadcrumb(category="auth", message="Authenticated user", level="info")
try:
1 / 0
except Exception as e:
sentry_sdk.capture_exception(e)